Reversible migration helper
What does this MR do?
This MR introduces a reversible_migration migration helper.
Use the reversible_migration helper to test migrations that are
reversible (ones that have either a change or both an up and down
that perform changes). This can test that the state of the application
and its data after the migration is reversed is the same as it was before
the migration ran in the first place. The helper:
- Runs the
beforeexpectations before the up migration - Migrates up
- Runs the
afterexpectations - Migrates down
- Runs the
beforeexpectations a second time
Example:
reversible_migration do |migration|
migration.before -> {
# ... pre-migration expectations
}
migration.after -> {
# ... post-migration expectations
}
end
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
-
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Performance and Testing
Edited by 🤖 GitLab Bot 🤖