How to generate migrations for existing database - Laravel
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:
- Do you want to log these migrations in the migrations table? (yes/no) - Type in "Yes" for this question.
- 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.
You can also create migration for specific table. Checkout below page for all the options
https://github.com/kitloong/laravel-migrations-generator
Comments (0)