Changin Db Transaction Control In Flyway With Hsql
Solution 1:
This is not possible inside a Flyway migration.
Before Flyway starts a migration, it opens a transaction in a separate connection to acquire a lock on its metadata table. So you will never be able to execute a statement that absolutely must be run without any other transactions.
Your best option is probably to set it on the datasource, so it can init each connection this way upon create.
Solution 2:
Try to use the Flyway callbacksbeforeMigrate and afterMigrate. Both run apart from the migration transactions. MVCC should be used for my application so the the JDBC URL contains hsqldb.tx=mvcc. I could sucessfully change the transaction model during the Flyway migration with beforeMigrate.sqlSET DATABASE TRANSACTION CONTROL LOCKS; and afterMigrate.sqlSET DATABASE TRANSACTION CONTROL MVCC;. There are also Java versions of the callbacks. I'm using HSQLDB 2.3.3 and Flyway 3.2.1.
Post a Comment for "Changin Db Transaction Control In Flyway With Hsql"