vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php line 465
same line number since Laravel 5.7 I guess, there's this line:
return Str::endsWith($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php');
This looks for the root migrations path matching the *_*.php
pattern. If it was **/*_*.php
you would've accomplished what you wanted.
But, good news! It can be hacked! The method responsible for getting the paths:
vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\BaseCommand.php line 19
says that the path argument you gave to the command, will not be sanitized, or modified,
if ($this->input->hasOption('path') && $this->option('path')) {
return collect($this->option('path'))->map(function ($path) {
return ! $this->usingRealPath()
? $this->laravel->basePath().'/'.$path
: $path;
})->all();
}
So, setting the path
argument as database/migrations/**
should enable you to recurse into subfolders.
php artisan migrate --path="database/migrations/**"
Note: Then, for every migrate[:*]
command to work, you need to specify the --path
attribute. I migrated and rolled back with the --path
attribute, and it worked.