Skip to content

Reversible migration helper

Luke Duncalfe requested to merge reversible_migration_helper into master

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:

  1. Runs the before expectations before the up migration
  2. Migrates up
  3. Runs the after expectations
  4. Migrates down
  5. Runs the before expectations 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

Performance and Testing

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading