mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
move applied migration identifiers table creation to the top of migrations execution
https://github.com/zdnk/GRDB.swift/commit/51ff937397248355d4b264aedfd5a8f05893a2b8 Thanks @zdnk :-)
This commit is contained in:
1 parent
2273efa07f
commit
0a8967ccde
1 file changed
+1
-1
@@ -252,6 +252,7 @@ public struct DatabaseMigrator {
|
||||
}
|
||||
|
||||
private func runMigrations(_ db: Database, upTo targetIdentifier: String) throws {
|
||||
try db.execute(sql: "CREATE TABLE IF NOT EXISTS grdb_migrations (identifier TEXT NOT NULL PRIMARY KEY)")
|
||||
let appliedIdentifiers = try self.appliedMigrations(db)
|
||||
|
||||
// Subsequent migration must not be applied
|
||||
@@ -271,7 +272,6 @@ public struct DatabaseMigrator {
|
||||
return
|
||||
}
|
||||
|
||||
try db.execute(sql: "CREATE TABLE IF NOT EXISTS grdb_migrations (identifier TEXT NOT NULL PRIMARY KEY)")
|
||||
for migration in unappliedMigrations {
|
||||
try migration.run(db)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user