Add SKIP_MIGRATIONS to run migrations out-of-band#2169
Merged
EItanya merged 2 commits intoJul 6, 2026
Merged
Conversation
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
EItanya
approved these changes
Jul 6, 2026
d104f2f
into
iplay88keys/migrations-improvements-pt-4
5 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Branched off of #2168, so will be rebased after that merges.
Description
Adds a
SKIP_MIGRATIONSopt-out so database migrations can run out-of-band (e.g. from a CI/CD pipeline) instead of at controller startup.--skip-migrationscontroller flag (settable via theSKIP_MIGRATIONSenv var; default off — startup migrations remain the default behavior).migrations.VerifyMigrated, refusing to start against a database that is not fully migrated. Per source: a missing tracking table, a version behind the binary's embedded max, or a dirty tracking table is a startup error with an actionable message; a database ahead of the binary boots in compatibility mode, matchingRunUp.VerifyMigratedissues onlySELECTs — it deliberately does not open golang-migrate, which creates the tracking table on every open — so the verification works on a connection whose role has no DDL privileges.database.postgres.skipMigrationsvalue (defaultfalse) rendered into the controller configmap asSKIP_MIGRATIONS, plus a NOTES warning when enabled reminding the operator that migrations must be applied out-of-band before install/upgrade.Testing
Verified on a kind cluster: upgrade with
skipMigrations=trueboots and logsdatabase schema verified; renaming a tracking table makes the controller exit withtracking table "vector_schema_migrations" does not exist — the database has not been migrated; apply migrations out-of-band or unset SKIP_MIGRATIONS; restoring the table recovers.Fresh install without migrations returns:
Controller starts up correctly when migrations are manually run against the db: