Skip to content

migration: Add runner package

Warren Gifford requested to merge ef/migration-runner into main

Created by: efritz

This PR adds a internal/database/migration/runner package that contains a the logic for running a set of migrations using the store introduced in #28599. Today, the runner mimmics the logic of golang-migrate:

  • Set the database version to the migration ID
  • Mark the database as dirty
  • Run the migration
  • Unmark the database as dirty

Additionally, we ensure that we're not skipping versions ahead or behind by ensuring that the current version is the expected one for the target migration direction. I'm not sure golang-migrate does this, so it's only added security.

In the future, once we control concurrency better and can move away from golang-migrate semantics, we can change this flow openly.

Merge request reports

Loading