diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 00:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 00:09:17 +0300 |
commit | c77fda905a8619b756163c10a75171dc9cfe7084 (patch) | |
tree | ffa93b37bfe4b99ba0b8584c7a0bd1a4cd19772a /doc/development/migration_style_guide.md | |
parent | e0fa0638a422c3e20d4423c9bb69d79afc9c7d3d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/migration_style_guide.md')
-rw-r--r-- | doc/development/migration_style_guide.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md index 7698492b29b..57f8ff36c00 100644 --- a/doc/development/migration_style_guide.md +++ b/doc/development/migration_style_guide.md @@ -89,6 +89,21 @@ be possible to downgrade in case of a vulnerability or bugs. In your migration, add a comment describing how the reversibility of the migration was tested. +Some migrations cannot be reversed. For example, some data migrations can't be +reversed because we lose information about the state of the database before the migration. +You should still create a `down` method with a comment, explaining why +the changes performed by the `up` method can't be reversed, so that the +migration itself can be reversed, even if the changes performed during the migration +can't be reversed: + +```ruby +def down + # no-op + + # comment explaining why changes performed by `up` cannot be reversed. +end +``` + ## Atomicity By default, migrations are single transaction. That is, a transaction is opened |