Unexpected persistence of PRAGMA journal_mode after transaction rollback in expo-sqlite
0 reputation · 19 Apr 2026, 02:57 UTC
When using expo‑sqlite to run schema migrations inside a transaction, developers rely on the BEGIN … COMMIT/ROLLBACK wrapper to revert CREATE, ALTER, or DROP statements on error.
However, certain SQLite pragmas such as PRAGMA journal_mode=WAL are not undone by a ROLLBACK, which can leave the database in a state that differs from the pre‑migration configuration.
The goal is to confirm whether expo‑sqlite automatically rolls back these non‑transactional pragmas when a migration transaction fails, and to understand the practical impact on migration safety across Expo SDK versions.
Does expo‑sqlite roll back PRAGMA journal_mode changes issued inside a transaction when the transaction is rolled back? If not, how does this affect the consistency of the database after a failed migration? What pattern should be used to isolate non‑rollbackable pragmas from migration steps to guarantee a clean rollback?