mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
move fix to private
This commit is contained in:
1 parent
9ea160b116
commit
cd6d46e349
1 file changed
+6
-8
@@ -214,14 +214,6 @@ public struct DatabaseMigrator {
|
||||
/// Returns the set of applied migration identifiers.
|
||||
public func appliedMigrations(in reader: DatabaseReader) throws -> Set<String> {
|
||||
return try reader.read { db in
|
||||
guard let doesMigrationsTableExist = try Bool.fetchOne(db, sql: "SELECT EXISTS (SELECT 1 FROM sqlite_master WHERE type='table' AND name='grdb_migrations')") else {
|
||||
fatalError("grdb_migrations check unexpectedly returned nil")
|
||||
}
|
||||
|
||||
guard doesMigrationsTableExist else {
|
||||
return Set()
|
||||
}
|
||||
|
||||
return try appliedIdentifiers(db)
|
||||
}
|
||||
}
|
||||
@@ -241,6 +233,12 @@ public struct DatabaseMigrator {
|
||||
}
|
||||
|
||||
private func appliedIdentifiers(_ db: Database) throws -> Set<String> {
|
||||
let tableExists = try Bool.fetchOne(db, sql: """
|
||||
SELECT EXISTS (SELECT 1 FROM sqlite_master WHERE type='table' AND name='grdb_migrations')
|
||||
""")!
|
||||
guard tableExists else {
|
||||
return []
|
||||
}
|
||||
return try Set(String.fetchAll(db, sql: "SELECT identifier FROM grdb_migrations"))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user