Repository navigation
Add no_transaction migration support - #30
Merged
Merged
Conversation
Allow migrations to opt out of transaction wrapping via no_transaction: true in metadata.yaml. Required for operations like CREATE INDEX CONCURRENTLY that cannot run inside a transaction block.
- noTransactTx: return errors from Close/Commit/Rollback/WithTransact instead of delegating unsafely to the DB pool - Split runNoTransaction to execute migration SQL in autocommit mode while wrapping log bookkeeping in its own transaction - Add multi-statement warning for no_transaction migrations - Add pg_indexes assertions to verify index creation/deletion in tests - Add unit tests for hasMultipleStatements
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.
Summary
no_transaction: truesupport inmetadata.yamlso migrations that use operations incompatible with transaction blocks (e.g.CREATE INDEX CONCURRENTLY) can opt out of being wrapped inBEGIN/COMMITnoTransactTx, adatabase.Txadapter that delegates directly to the underlying DB without opening a transaction.mise.toml→mise.tomldoc/concepts.mdanddoc/migration.mdCommits
1e8fafbUpgrade Go toolchain to 1.24.302b551cAdd no_transaction migration supportca07522Document non-transactional migrationsTest plan
go test ./...passes (all packages green)no_transaction: truerunsCREATE INDEX CONCURRENTLYwithout error against a live Postgres instance