Discussion Laravel

Laravel divide migrations into separate folders and run at once.

Add following code snippet in boot method of AppServiceProvider

$mainPath = database_path('migrations');ň
$directories = glob($mainPath . '/*' , GLOB_ONLYDIR);
$paths = array_merge([$mainPath], $directories);

$this->loadMigrationsFrom($paths);

After that we can just run `php artisan migrate` and all migrations will be run at once.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *