-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Introduce suspenders:db:migrate
task
#1161
Conversation
I tested this locally and it worked.
|
Lifted from our [dotfiles][], this task runs the latest migration, rolls it back, and runs it again in an effort to ensure it's reversible. More context can be found [in these comments][]. Unfortunately, this implementation did not work because Rake recognized that it `db:migrate` was already invoked, so it wasn't invoked a second time. Instead, we needed to `reenable` the task manually. ```ruby task migrate: ["db:migrate", "db:rollback", "db:migrate", "db:test:prepare"] ``` [dotfiles]: https://github.com/thoughtbot/dotfiles/blob/f149484269ef98e2bc80b7daa1988e214ddf8e8b/aliases#L12 [in these comments]: thoughtbot/dotfiles@4882c41#r1933964
71ccd24
to
a25ddf6
Compare
What is the advantage of this approach vs |
@crackofdusk this is a great question. When there's a pending migration,
However, if the migration has been run, then
This is in contrast to |
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.
- LGTM, pushing this into Suspenders makes some sense (though I still need the shell alias for most Boost projects).
- Should it be called like
suspenders:db:migrate
? I worry that we might one day want a way to migrate part of Suspenders itself.
suspenders:migrate
tasksuspenders:db:migrate
task
Lifted from our [dotfiles][], this task runs the latest migration, rolls it back, and runs it again in an effort to ensure it's reversible. More context can be found [in these comments][]. Unfortunately, the following implementation did not work because Rake recognized that it `db:migrate` was already invoked, so it wasn't invoked a second time. ```ruby task migrate: ["db:migrate", "db:rollback", "db:migrate", "db:test:prepare"] ``` Instead, we needed to `reenable` the task manually. [dotfiles]: https://github.com/thoughtbot/dotfiles/blob/f149484269ef98e2bc80b7daa1988e214ddf8e8b/aliases#L12 [in these comments]: thoughtbot/dotfiles@4882c41#r1933964
Lifted from our dotfiles, this task runs the latest migration, rolls
it back, and runs it again in an effort to ensure it's reversible. More
context can be found in these comments.
Unfortunately, the following implementation did not work because Rake recognized
that it
db:migrate
was already invoked, so it wasn't invoked a secondtime.
Instead, we needed to
reenable
the task manually.