mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-22 04:00:39 +00:00
Fix test concurrency errors for DatabaseMigrator
This commit is contained in:
1 parent
856cc69088
commit
ae2c7ad364
13 files changed
+19
-15
No files matched your search
@@ -789,13 +789,17 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.eraseDatabaseOnSchemaChange = true
|
||||
|
||||
var witness = 1
|
||||
class Context {
|
||||
var witness = 1
|
||||
}
|
||||
let context = Context()
|
||||
|
||||
migrator.registerMigration("1") { db in
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE t1(id INTEGER PRIMARY KEY);
|
||||
INSERT INTO t1(id) VALUES (?)
|
||||
""", arguments: [witness])
|
||||
witness += 1
|
||||
""", arguments: [context.witness])
|
||||
context.witness += 1
|
||||
}
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
|
||||
@@ -15,7 +15,7 @@ private class Person : Record {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE persons (
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
||||
@@ -13,7 +13,7 @@ private class MinimalNonOptionalPrimaryKeySingle: Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: "CREATE TABLE minimalSingles (id TEXT NOT NULL PRIMARY KEY)")
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class MinimalRowID : Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: "CREATE TABLE minimalRowIDs (id INTEGER PRIMARY KEY)")
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class MinimalSingle: Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: "CREATE TABLE minimalSingles (UUID TEXT NOT NULL PRIMARY KEY)")
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ private class Person : Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE persons (
|
||||
creationDate TEXT NOT NULL,
|
||||
|
||||
@@ -14,7 +14,7 @@ private class Citizenship : Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE citizenships (
|
||||
personName TEXT NOT NULL,
|
||||
|
||||
@@ -14,7 +14,7 @@ private class Item : Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE items (
|
||||
name TEXT,
|
||||
|
||||
@@ -16,7 +16,7 @@ private class Person : Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE persons (
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
||||
@@ -12,7 +12,7 @@ class Pet : Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE pets (
|
||||
UUID TEXT NOT NULL PRIMARY KEY,
|
||||
|
||||
@@ -11,7 +11,7 @@ class Email : Record, Hashable {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE emails (
|
||||
email TEXT NOT NULL PRIMARY KEY ON CONFLICT REPLACE,
|
||||
|
||||
@@ -15,7 +15,7 @@ private class Person : Record {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE persons (
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
||||
@@ -13,7 +13,7 @@ class BadlyMangledStuff : Record {
|
||||
super.init()
|
||||
}
|
||||
|
||||
static func setup(inDatabase db: Database) throws {
|
||||
@Sendable static func setup(inDatabase db: Database) throws {
|
||||
try db.execute(sql: "CREATE TABLE stuffs (id INTEGER PRIMARY KEY, name TEXT)")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user