Repository navigation
Conversation
…l after a snapshot sisf up --approve-migrations=<versions> lets the Owner approve exactly the incompatible migrations pending on an existing store. Before migrating, the store is snapshotted to <dir>/backups: VACUUM INTO for SQLite, pg_dump through the state container in Docker mode. A failed snapshot stops the upgrade, and the applied approval is written to the audit log. Fixes #76 Signed-off-by: Goon <duy@wearetopgroup.com>
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.
Fixes #76.
What
On an existing store, a migration that is not backward compatible (12 today) can now be applied, but only on the Owner's approval and only after a snapshot:
sisf up --approve-migrations=<versions>. The approval must name exactly the incompatible migrations pending; this is checked under the migration lock. A partial set, an extra version or a different set is refused withAPPROVAL_REQUIRED, and nothing is applied. With nothing incompatible pending, the flag changes nothing.<dir>/backups/(dir 0700, file 0600):VACUUM INTOof the SQLite file.pg_dump --format=customthrough the state container, before the state-bootstrap step.state.migrate_approved, recording actorowner:local, the versions and the snapshot name.Decision (delegated)
The Owner delegated the ADR 0013 decision ("tự quyết sao cho tốt nhất rồi ghi lại quyết định"). It is recorded in the ADR and on #76.
Shared-contract change
pkg/state/state.gochanges:MigrateOptions.Approved []int;state.ApprovesExactly.The
Migratorinterface is unchanged.Verification
go build ./...,go vet,gofmt: clean.golangci-lint run: 0 issues.go test -race ./...: green.tests/acceptancepassed in a run of its own (319s). In the full local run it hit the default 10-minute timeout while the PostgreSQL suite was running alongside it.SISF_TEST_PG_DSN, postgres:16) passed forpkg/state/...andinternal/install/....docker exec:pg_dumpcustom format, thendropdb/createdb/pg_restore;