Delete existing migrations

When removing existing migrations from the GitLab project, you have to take into account the possibility of the migration already been included in past releases or in the current release, and thus already executed on GitLab.com and/or in self-hosted instances.

Because of it, it's not possible to delete existing migrations, as that could lead to:

Instead of deleting we can opt for disabling the migration.

Pre-requisites to disable a migration

Migrations can be disabled if:

How to disable a data migration?

In order to disable a migration, the following steps apply to all types of migrations:

  1. Turn the migration into a noop by removing the code inside #up, #down or #perform methods, and adding #no-op comment instead.
  2. Add a comment explaining why the code is gone.

Disabling migrations requires explicit approval of Database Maintainer.

Examples