Switch to using goose for migrations - #2667
Merged
Merged
Conversation
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
iplay88keys
force-pushed
the
iplay88keys/goose-migrations
branch
from
September 2, 2026 23:50
6b00123 to
a7aeb46
Compare
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
…rations Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
iplay88keys
marked this pull request as ready for review
September 3, 2026 16:48
…rations Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io> # Conflicts: # go/core/cmd/controller-v2/main.go
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
…rations Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io> # Conflicts: # go/core/pkg/migrations/core/000001_initial.down.sql # go/core/pkg/migrations/core/000001_initial.up.sql # go/core/pkg/migrations/core/000002_not_null_defaults.down.sql # go/core/pkg/migrations/core/000002_not_null_defaults.up.sql
EItanya
reviewed
Sep 3, 2026
…rations Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io> # Conflicts: # go/core/pkg/migrations/core/000001_initial.down.sql # go/core/pkg/migrations/core/000001_initial.up.sql
Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
EItanya
approved these changes
Sep 4, 2026
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.
Warning
This is an intentional clean slate for 1.0:
Summary
Replace golang-migrate with Goose and establish a clean PostgreSQL migration baseline for Kagent 1.0.
Why
golang-migrate records a dirty version separately from the migration transaction. A failure between the schema commit and version update can leave committed schema marked dirty and require an operator to force a version.
Goose records both in the same PostgreSQL transaction, so a failed migration rolls back cleanly and startup can retry it. Substrate PR #1196 made the same change; this review thread describes the failure mode.
Changes
Migration engine and baseline
github.com/golang-migrate/migratewithgithub.com/pressly/goose/v3.000001_initial.sqlbaselines.UpandDownsections and rejectNO TRANSACTIONmigrations.Controller and CLI
DATABASE_VECTOR_ENABLED=trueincludes vector migrations and registers pgvector types on database connections.SKIP_MIGRATIONS=trueverifies migration state without applying migrations.kagent env --component databasedocuments them and the CLI reuses the same vector-setting name.forcebehavior with Goose-backedup,down,goto,status, andversioncommands.Upgrade coverage
adjacentandprev-stablematrix legs. The setup skips 0.10.x because it predates Goose; there will be no 0.11.x. Once a 1.0 prerelease or final tag exists, the previous-stable leg automatically begins enforcing compatibility with 1.0.Verification
origin/mainmigrations and the Goose baselines to separate fresh databases; normalized schema-only dumps matched exactly after excluding their intentionally different migration ledgers.make -C go sqlc-generatego/:go test ./core/pkg/migrations ./core/cli/internal/db/migrate ./core/test/upgrade ./core/internal/database ./core/pkg/app ./core/cmd/controllergo/: focused short, race, vet, CLI, and E2E compile checks.make -C go lintbash scripts/version-resolution_test.sh