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 GitLab Self-Managed instances.
Because of it, it’s not possible to delete existing migrations, as that could lead to:
- Schema inconsistency, as changes introduced into the database were not rolled back properly.
- Leaving a record on the
schema_versions
table, that points out to migration that no longer exists on the codebase.
Instead of deleting we can opt for disabling the migration.
Pre-requisites to disable a migration
Migrations can be disabled if:
- They caused a timeout or general issue on GitLab.com.
- They are obsoleted, for example, changes are not necessary due to a feature change.
- Migration is a data migration only, that is, the migration does not change the database schema.
How to disable a data migration?
In order to disable a migration, the following steps apply to all types of migrations:
- Turn the migration into a no-op by removing the code inside
#up
,#down
or#perform
methods, and adding# no-op
comment instead. - Add a comment explaining why the code is gone.
Disabling migrations requires explicit approval of Database Maintainer.
Examples
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support