Reversibility of DB migrations
During verifying https://gitlab.com/gitlab-com/infrastructure/issues/1267 it seems that reversibility of our migrations is poor, because:
- We use custom
add_concurrent_index
andadd_concurrent_foreign_key
which are not reversible by default, - We merge concurrent with
def change
, instead of requesting to havedef up/def down
, - We do not have CI job to ensure that migrations are reversible,
Take a look at this commit and what it does to make sure that migrations up to 8.17.2 can be reversed. We should improve our tooling to enforce 2. and 3.