Public repository: timo / mitch

Reader

A migration stitcher (therefore mitch) for PostgreSQL, SQLite, MariaDB, and others

mitch / docs / adr / runner / non-transactional-migrations-run-in-autocommit.md · 560 bytes · at 76a2c3d332a1 · raw


status: accepted

Non-transactional migrations run alone in autocommit mode

Some SQL statements (such as CREATE INDEX CONCURRENTLY in PostgreSQL) refuse to run inside a transaction. A migration may therefore declare transactional = false. The runner groups consecutive transactional migrations into one transaction, and gives each non-transactional migration its own batch with the connection switched to autocommit. The cost is that a failure in a non-transactional migration cannot be rolled back, which the author accepts by setting the flag.