When I started this project, I renamed specific migration files to start with 9999, so I would assure they ran last when running a fresh migration.
I soon found this was a mistake, because now I have over 200 migration files and every time I create a new migration that inserts default data I have to rename my migration file. Long story short, I should have just left my migration files to run sequentially and not altered them.
What I am trying to do now is move all my existing migrations to a new folder, then run that folder first and all other migrations after that. This way I don't need to change all 200 database records and file names and all new migrations would just run as they should have.
Im not sure if this is even possible or is there a better way?
CodePudding user response:
In order to run that command inside the migration you can do:
use Illuminate\Support\Facades\Artisan;
Artisan::call('artisan migrate --path=/database/migrations/OldMigrations/*);
CodePudding user response:
Run this artisan command It will work:
php artisan migrate --path=/database/migrations/OldMigrations/*