To generate migrations for the existing database you can install following package:

composer require --dev kitloong/laravel-migrations-generator

After the installation, run following artisan command:

php artisan migrate:generate


You will be asked with two questions:

  1. Do you want to log these migrations in the migrations table? (yes/no) - Type in "Yes" for this question.
  2. This command also asks you set batch number to 0. Its a kind of priority order, So set "0" for this question, which is recommended setting.
After that, the package will create migration for each table. Thats it!


You can also create migration for specific table. Checkout below page for all the options
https://github.com/kitloong/laravel-migrations-generator 
 



Comments (0)
Leave a Comment

loader Posting your comment...