David Carr
03/21/2023, 10:32 PMIf the driver supports it, migrations are run in a transaction. You should not surround your migrations inWe have hundreds of migrations in our app that start with, as this can cause a crash with some drivers.BEGIN/END TRANSACTION
BEGIN TRANSACTION and end with COMMIT that have worked fine. Recently, we encountered an upgrade that triggered a android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5 SQLITE_BUSY[5]) exception, and removing this fixed it.
Do all migrations on Android already run in a transaction? Was looking at the driver code, and couldn't see where that is done. Is this advice accurate? Should we remove BEGIN TRANSACTION from our existing migration files to be safe, and continue avoiding it going forward?