Reversibility of DB migrations

During verifying https://gitlab.com/gitlab-com/infrastructure/issues/1267 it seems that reversibility of our migrations is poor, because:

  1. We use custom add_concurrent_index and add_concurrent_foreign_key which are not reversible by default,
  2. We merge concurrent with def change, instead of requesting to have def up/def down,
  3. 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.

cc @yorickpeterse @stanhu @DouweM @smcgivern @rymai

Edited Sep 13, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading