Laravel / lumen 5.2 creates migration tables from an existing database

Is it possible to create a migration scheme from an existing database in lumen / laravel 5.2? is there any package?

I connect lumen to the magento database, now I need to use eloquence. I do not have time to create a migration model for each table.

+5
source share
2 answers

You can dump the database first with the mysqldump tool into the sql file, and then in your migration you can do something like this:

public function up() { $path = 'path_to_sql/dump.sql'; DB::unprepared(file_get_contents($path)); } 
+5
source

Some easy way I found:

  • Install the latest version of Laravel and create a project named 'migratedb'
  • Set the env database to the one you want to migrate
  • Install the Xethron library to create migrations, https://github.com/Xethron/migrations-generator and follow the instructions
  • Install the Iseed library to create reverse migrations, https://github.com/orangehill/iseed and follow the instructions
  • Copy content from database / migrations and database / seeds from Laravel 'migratedb' to your Lumen project
0
source

All Articles