-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.3] Add --path option support for artisan migrate:rollback/refresh/reset fixes #13631 #15251
[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
--path
command option to the RollbackCommand, RefreshCommand and ResetCommand to support rolling back commands that may have been executed with the--path
option in the MigrateCommand. This is especially needed for multitenant db migrations where tenant database migrations are typically stored in atenant
subfolder 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/tenant
subfolder. I have a custom Artisan command (php artisan migrate:tenant
) which, in turn, callsphp artisan migrate
for each tenant and passes the--database=tenant
option to specify the tenant database connection and the--path
option 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 mainmigrations
folder, not themigrations/tenant
subfolder. So, the--path
option is needed on the rollback, refresh and reset commands in order to make this work.