-
Couldn't load subscription status.
- Fork 22k
Support multiple database migrations when running pending migrations. #39757
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
Support multiple database migrations when running pending migrations. #39757
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried out Rails::Command.invoke("db:migrate") but kept getting Don't know how to build task 'rails --task' (See the list of available tasks with rails --tasks) when running the railties test suite.
b7de23d to
7344d72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a little backwards to me. What about updating ActiveRecord::Tasks::DatabaseTasks#migrate to handle multiple databases (or adding a new method, if necessary)? Then the db:migrate Rake task can be refactored to delegate to that method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried out Rails::Command.invoke("db:migrate") but kept getting Don't know how to build task 'rails --task' (See the list of available tasks with rails --tasks) when running the railties test suite.
Rails::Command.invoke("db:migrate") works perfectly in a Rails app but the railties test suite has a different behavior which I can't seem to figure out.
|
Test failures don't seem to be related. Seeing it happen on the master branch as well: https://buildkite.com/rails/rails/builds/70429 |
7344d72 to
d760e8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonathanhefner It turns out adding a migrate_all to DatabaseTasks was pretty straight forward.
|
Build seems to be consistently broken? I'll retry the build after a few hours. |
|
Do we want the migrations to run for all the databases? I read in a number of PRs that sometimes migrations may be applied to one database but not the other. |
|
If a migration is created in the migrations path of a particular database, I believe we should run those migrations |
Also fixes the issue where running pending migrations does not dump the schema.
d760e8f to
9785b00
Compare
Summary
Support multiple database migrations when running pending migrations.
Also fixes the issue where running pending migrations does not dump the
schema.
Other Information
Related to #34788 and #26542