Skip to content

oobmigrations: Startup check

Administrator requested to merge ef/oob-startup-check into main

Created by: efritz

Update frontend startup to check out of band migration status and block startup if there are unfinished up or down migrations that may result in data loss. Fixes https://github.com/sourcegraph/sourcegraph/issues/18240. Fixes https://github.com/sourcegraph/sourcegraph/issues/20906. Fixes https://github.com/sourcegraph/sourcegraph/issues/18241.

Summary of changes (review by commit):

  • DB Changes:
    • Add first_version field to versions table that is populated with the first value of version written to the table (via upsert or migration)
    • Add is_enterprise flag to out_of_band_migrations table
    • Split introduced and deprecated columns into introduced_version_{major,minor} and deprecated_version_{major,minor} columns
  • Code changes:
    • Add utility method in cmd/frontend/backend package to query it new first_version column
    • Modify oobmigration/Store.List to omit enterprise-only migrations in OSS mode
    • Add oobmigration/Runner.Validate method that tells which migrations are breaking their guarantees based on the current instance version
    • Invoke Validate on frontend startup

Merge request reports

Loading