[5.3] Add --path option support for artisan migrate:rollback/refresh/reset fixes #13631#15251
Conversation
|
This won't work in my opinion. You may be providing the path, but it would still load all the migrations path. |
|
I have tested this change and it indeed works with 5.3.x as the Let me know if you have any questions. |
|
Also doesn't work --path option in migrate:refresh and migrate:reset |
|
@afigienas looks like the |
|
@anderly but looks like $path variable are not sent to rollback or reset command. |
|
it is used only in so the error comes in "clear DB" step |
|
@afigienas oh, you're right! I only saw that the path option was defined. Ok, so looks like the RefreshCommand and ResetCommand should respect and send the I'll add those changes to this PR. |
…aravel#13631 Added path support for artisan migrate:rollback/refresh/reset fixed laravel#13631 Add --path support to ResetCommand and RefreshCommand Add --path to refresh command test. Update refresh command test.
04c70c0 to
665ab29
Compare
|
Updated |
Added the
--pathcommand option to the RollbackCommand, RefreshCommand and ResetCommand to support rolling back commands that may have been executed with the--pathoption in the MigrateCommand. This is especially needed for multitenant db migrations where tenant database migrations are typically stored in atenantsubfolder of the migrations directory.More background:
I have a multi-tenant app with one main application/security database and separate tenant databases. I keep tenant migrations stored in a
migrations/tenantsubfolder. I have a custom Artisan command (php artisan migrate:tenant) which, in turn, callsphp artisan migratefor each tenant and passes the--database=tenantoption to specify the tenant database connection and the--pathoption to specify the path to the tenant migrations (i.e.database/migrations/tenant). This works fine and executes the migrations against the tenant database(s), but if I try to runphp artisan migrate:rollback --database=tenant, it tries to rollback the migrations in the mainmigrationsfolder, not themigrations/tenantsubfolder. So, the--pathoption is needed on the rollback, refresh and reset commands in order to make this work.