oobmigrations: Startup check
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 toversions
table that is populated with the first value ofversion
written to the table (via upsert or migration) - Add
is_enterprise
flag toout_of_band_migrations
table - Split
introduced
anddeprecated
columns intointroduced_version_{major,minor}
anddeprecated_version_{major,minor}
columns
- Add
- Code changes:
- Add utility method in
cmd/frontend/backend
package to query it newfirst_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
- Add utility method in