Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.6: Migration from a specific folder

I am trying to use php artisan migrate --path="/database/migrations/ef to use only the migrations in that path. But I got "Nohting no migrate" and the migration files are in that direction.

I tried to adding this to boot method in AppServiceProvider, that is from this link Laravel running migrations on "app/database/migrations" folder recursively:

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

$this->loadMigrationsFrom($paths);

But it does not work either.

like image 288
alfredjmg Avatar asked Sep 20 '18 17:09

alfredjmg


1 Answers

for Laravel >= 5.0, the correct commands to migrate migration files in sub directories would be:

php artisan migrate --path=/database/migrations/ef
php artisan migrate --path=/database/migrations/relations
like image 111
Ashish Avatar answered Sep 29 '22 07:09

Ashish