When run 'php artisan migrate' in windows os: laravel migrate all file (\database\migrations in root folder and in packages folder). But in Linux os just migrate file in \database\migrations of root folder. I have Database\migrations folder in packages folder and use the loadMigrationsFrom method in function boot() of service provider class. How do I can migrate all files in Linux?
CodePudding user response:
You can give path to your migrate function like
php artisan migrate --path=database/migrations/packages
CodePudding user response:
I think the only way to do it right now is to manually go through all the migrations. You have to run the migration command on each of your sub-folders:
php artisan migrate --path=database/migrations/folder_name*
or you can add this to boot method in AppServiceProvider:
$mainPath = database_path('migrations'); $directories = glob($mainPath . '/*' , GLOB_ONLYDIR); $paths = array_merge([$mainPath], $directories);
$this->loadMigrationsFrom($paths);