Fix table error from BG migration rake task
What does this MR do and why?
Fix an error that can occur when running db:migrate
during development. If we rollback the schema too far, the db:migrate
task will fail, due to trying to process batched background migrations against a database state where the batched_background_migrations
table doesn't exist.
It's pretty uncommon to run into this, but I hit it frequently when working/testing through the removal of old migrations recently.
How to set up and validate locally
- On
master
, roll back migrations to the beginning, and you'll see the error about the missing tablebundle exec rails db:migrate VERSION=20181228175414 rails aborted! ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "batched_background_migrations" does not exist LINE 8: WHERE a.attrelid = '"batched_background_migrations"'::regcl...
- On this branch, run the same command, and it should be fine
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Patrick Bair