Skip to content

Add no_transaction migration support - #30

Merged
BolajiOlajide merged 5 commits into
mainfrom
feat/no-transaction-migrations
Feb 19, 2026
Merged

BolajiOlajide merged 5 commits into
mainfrom
feat/no-transaction-migrations

Conversation

@BolajiOlajide

@BolajiOlajide BolajiOlajide commented Feb 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Adds no_transaction: true support in metadata.yaml so migrations that use operations incompatible with transaction blocks (e.g. CREATE INDEX CONCURRENTLY) can opt out of being wrapped in BEGIN/COMMIT
  • Introduces noTransactTx, a database.Tx adapter that delegates directly to the underlying DB without opening a transaction
  • Upgrades Go toolchain to 1.24.3 and renames .mise.toml → mise.toml
  • Documents the new behaviour in doc/concepts.md and doc/migration.md

Commits

  • 1e8fafb Upgrade Go toolchain to 1.24.3
  • 02b551c Add no_transaction migration support
  • ca07522 Document non-transactional migrations

Test plan

  • go test ./... passes (all packages green)
  • Manually verify a migration with no_transaction: true runs CREATE INDEX CONCURRENTLY without error against a live Postgres instance
  • Verify a standard (transactional) migration is unaffected
  • Review warning copy in docs for accuracy

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
@BolajiOlajide
BolajiOlajide merged commit 17e57d5 into main Feb 19, 2026
2 checks passed
@BolajiOlajide
BolajiOlajide deleted the feat/no-transaction-migrations branch February 19, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址