Document that migrations run with deferred foreign key checks

This commit is contained in:
Gwendal Roué committed 2020-02-27 08:43:51 +01:00
1 parent bf89883ff5
commit 0d2ede4440
1 file changed
+2
+2
View File
@@ -4921,6 +4921,8 @@ migrator.registerMigration("v2") { db in
**Each migration runs in a separate transaction.** Should one throw an error, its transaction is rollbacked, subsequent migrations do not run, and the error is eventually thrown by `migrator.migrate(dbQueue)`.
**Migrations run with deferred foreign key checks,** starting SQLite 3.7.16+ (iOS 9.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ / [custom SQLite build] / [SQLCipher](#encryption)). This means that eventual foreign key violations are only checked at the end of the migration (and they make the migration fail).
**The memory of applied migrations is stored in the database itself** (in a reserved table).
You migrate the database up to the latest version with the `migrate(_:)` method: