-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Closed
Copy link
Labels
enhancementNew feature or requestNew feature or request
Description
I have found these related issues/pull requests
Relates to #2085
Description
When using Sqlite3 you need to setup some (feature) settings for your database initially like
-- 00000_initial_setup.sql
PRAGMA foreign_keys = ON;
PRAGMA journal_mode = WAL;However, the migrator runs the whole file in a single transaction, which is correct for the remaining migration files, but leads to an error with Sqlite3:
ExecuteMigration(Database(SqliteError { code: 1, message: "Safety level may not be changed inside a transaction" }), 0)
Prefered solution
Add some (comment) marker to the migration file format that instructs the migrator to run this particular file outside of a transaction. E.g. the popular dbmate migration tool supports a feature flag "transaction" among others:
-- migrate:up transaction:false
PRAGMA foreign_keys = ON;
PRAGMA journal_mode = WAL;Alternatively, document the workaround of #2085 (comment):
-- terminate the original migrator TRANSACTION
COMMIT TRANSACTION;
-- 00000_initial_setup.sql
PRAGMA foreign_keys = ON;
PRAGMA journal_mode = WAL;
-- restart new migrator TRANSACTION
BEGIN TRANSACTION;Is this a breaking change? Why or why not?
No breaking change, as this would be an optional, additional feature flag.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request