How to import a mysql dump to a laravel migration

0 votes
I have a complete database and need to create migration. I guess there must be a way to do it from a dump but not sure. Is there any way automatically or at least easier to do this task?
Apr 3, 2020 in Laravel by kartik
• 37,520 points
7,008 views

1 answer to this question.

0 votes

Hello @kartik

You can import dumps in Laravel like this:

DB::unprepared(file_get_contents('full/path/to/dump.sql'));

If I were to refactor an existing app, though, I'd take the time to write migrations from scratch, import the dump into different tables (or a different db, if table names are the same) then import the content to the new structure via seeds.

Hope this helps you!

Thank You!!

answered Apr 3, 2020 by Niroj
• 82,840 points

Related Questions In Laravel

0 votes
1 answer

How to make a new page with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
13,038 views
0 votes
1 answer

How to mock a static facade methods in Laravel?

Hey, Facades provide a "static" interface to classes ...READ MORE

answered Mar 19, 2020 in Laravel by Niroj
• 82,840 points
6,538 views
0 votes
1 answer

What is database migration and how to create database migration in Laravel?

Hii, Migrations are like version control for your database, ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,339 views
0 votes
1 answer

.How to turn off CSRF protection for a particular route in Laravel?

Hey, We can add that particular URL or ...READ MORE

answered Mar 24, 2020 in Laravel by Niroj
• 82,840 points
4,213 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,012 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,995 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,918 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,692 views
+2 votes
2 answers

How to add a new column to existing table of laravel in a migration?

You need do little modification in your ...READ MORE

answered Dec 10, 2020 in Laravel by anonymous
• 82,840 points
123,880 views
0 votes
1 answer

How to populating a database in a Laravel migration file?

Hello @kartik, Don't put the DB::insert() inside of ...READ MORE

answered Aug 4, 2020 in Laravel by Niroj
• 82,840 points
3,110 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP