I meant to run a rollback on a different database, but didn’t specify the name of the database name like so:
rake db:rollback VERSION=20200509010531
Instead of an error saying it wasn’t finding that version, the last migration in the migrations
directory was rolled back. Caused me a little WTF.
1 Like
I work with @leskat. My process for rolling back migrations on our secondary db is inevitably something like:
bin/rails db:rollback
- OOPS. uh,
bin/rails db:rollback --database secondary_db_name
? - Hmmmmm, right, it’s that one I can never remember.
bin/rake -T | grep db
- UGHHHHHH why is the one I can never remember not actually listed with
bin/rake -T
-
db:migrate:down
IS listed, and feels close, but I know I need to putsecondary_db_name
in there somewhere. Is itbin/rails db:migrate:secondary_db_name:down VERSION=#
? - No. It is the other one. Drat. At least I got a useful error this time.
- successfully running
bin/rails db:migrate:down:secondary_db_name VERSION=#
2 Likes