From a6c86ea7f7be760cc5c324159da4711a43c255f3 Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Mon, 15 Apr 2024 04:45:51 -0500 Subject: [PATCH] Fix up FluentKit tests after SQLKit update --- .../AsyncTests/AsyncFluentKitTests.swift | 28 ++++++++-------- Tests/FluentKitTests/CompositeIDTests.swift | 2 +- Tests/FluentKitTests/FluentKitTests.swift | 32 +++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Tests/FluentKitTests/AsyncTests/AsyncFluentKitTests.swift b/Tests/FluentKitTests/AsyncTests/AsyncFluentKitTests.swift index 5214134e..ab1683b4 100644 --- a/Tests/FluentKitTests/AsyncTests/AsyncFluentKitTests.swift +++ b/Tests/FluentKitTests/AsyncTests/AsyncFluentKitTests.swift @@ -119,12 +119,12 @@ final class AsyncFluentKitTests: XCTestCase { _ = try await Planet.query(on: db).unique().count(\.$name) XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"SELECT COUNT(DISTINCT("planets"."name")) AS "aggregate" FROM "planets" WHERE ("planets"."deleted_at" IS NULL OR "planets"."deleted_at" > $1)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"SELECT COUNT(DISTINCT "planets"."name") AS "aggregate" FROM "planets" WHERE ("planets"."deleted_at" IS NULL OR "planets"."deleted_at" > $1)"#) db.reset() _ = try await Planet.query(on: db).unique().sum(\.$id) XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"SELECT SUM(DISTINCT("planets"."id")) AS "aggregate" FROM "planets" WHERE ("planets"."deleted_at" IS NULL OR "planets"."deleted_at" > $1)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"SELECT SUM(DISTINCT "planets"."id") AS "aggregate" FROM "planets" WHERE ("planets"."deleted_at" IS NULL OR "planets"."deleted_at" > $1)"#) db.reset() } @@ -141,7 +141,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT NOT NULL)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT NOT NULL)"#) } func testIdentifierFieldConstraint() async throws { @@ -151,7 +151,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT PRIMARY KEY)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT PRIMARY KEY)"#) db.reset() try await db.schema("planets") @@ -159,7 +159,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY)"#) } func testForeignKeyFieldConstraint() async throws { @@ -169,7 +169,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT REFERENCES "galaxies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT REFERENCES "galaxies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)"#) db.reset() try await db.schema("planets") @@ -177,7 +177,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT REFERENCES "galaxies" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT REFERENCES "galaxies" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)"#) } func testMultipleFieldConstraint() async throws { @@ -187,7 +187,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY)"#) } func testUniqueTableConstraint() async throws { @@ -198,7 +198,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT, CONSTRAINT "uq:planets.id" UNIQUE ("id"))"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT, CONSTRAINT "uq:planets.id" UNIQUE ("id"))"#) db.reset() try await db.schema("planets") @@ -208,7 +208,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT, "name" TEXT, CONSTRAINT "uq:planets.id+planets.name" UNIQUE ("id", "name"))"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT, "name" TEXT, CONSTRAINT "uq:planets.id+planets.name" UNIQUE ("id", "name"))"#) } func testForeignKeyTableConstraint() async throws { @@ -219,7 +219,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT, CONSTRAINT "fk:planets.galaxy_id+planets.id" FOREIGN KEY ("galaxy_id") REFERENCES "galaxies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT, CONSTRAINT "fk:planets.galaxy_id+planets.id" FOREIGN KEY ("galaxy_id") REFERENCES "galaxies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)"#) db.reset() try await db.schema("planets") @@ -233,7 +233,7 @@ final class AsyncFluentKitTests: XCTestCase { .create() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT, CONSTRAINT "fk:planets.galaxy_id+planets.id" FOREIGN KEY ("galaxy_id") REFERENCES "galaxies" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT, CONSTRAINT "fk:planets.galaxy_id+planets.id" FOREIGN KEY ("galaxy_id") REFERENCES "galaxies" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)"#) } func testIfNotExistsTableCreate() async throws { @@ -245,7 +245,7 @@ final class AsyncFluentKitTests: XCTestCase { XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE IF NOT EXISTS "planets"("galaxy_id" BIGINT)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE IF NOT EXISTS "planets" ("galaxy_id" BIGINT)"#) db.reset() try await db.schema("planets") @@ -254,7 +254,7 @@ final class AsyncFluentKitTests: XCTestCase { XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT)"#) } func testCreateEmptyModelArrayDoesntQuery() async throws { diff --git a/Tests/FluentKitTests/CompositeIDTests.swift b/Tests/FluentKitTests/CompositeIDTests.swift index 53a0aa05..91955d92 100644 --- a/Tests/FluentKitTests/CompositeIDTests.swift +++ b/Tests/FluentKitTests/CompositeIDTests.swift @@ -83,7 +83,7 @@ final class CompositeIDTests: XCTestCase { let db = DummyDatabaseForTestSQLSerializer() try CompositePlanetTagMigration().prepare(on: db).wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "composite+planet+tag"("planet_id" UUID NOT NULL REFERENCES "planets" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, "tag_id" UUID NOT NULL REFERENCES "tags" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, "notation" TEXT NOT NULL, "createdAt" TIMESTAMPTZ, "updatedAt" TIMESTAMPTZ, "deletedAt" TIMESTAMPTZ, PRIMARY KEY ("planet_id", "tag_id"))"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "composite+planet+tag" ("planet_id" UUID NOT NULL REFERENCES "planets" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, "tag_id" UUID NOT NULL REFERENCES "tags" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, "notation" TEXT NOT NULL, "createdAt" TIMESTAMPTZ, "updatedAt" TIMESTAMPTZ, "deletedAt" TIMESTAMPTZ, PRIMARY KEY ("planet_id", "tag_id"))"#) } func testCompositeIDRelations() throws { diff --git a/Tests/FluentKitTests/FluentKitTests.swift b/Tests/FluentKitTests/FluentKitTests.swift index 0e540109..1fc25e3d 100644 --- a/Tests/FluentKitTests/FluentKitTests.swift +++ b/Tests/FluentKitTests/FluentKitTests.swift @@ -176,12 +176,12 @@ final class FluentKitTests: XCTestCase { _ = try? Planet.query(on: db).unique().count(\.$name).wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"SELECT COUNT(DISTINCT("planets"."name")) AS "aggregate" FROM "planets" WHERE ("planets"."deleted_at" IS NULL OR "planets"."deleted_at" > $1)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"SELECT COUNT(DISTINCT "planets"."name") AS "aggregate" FROM "planets" WHERE ("planets"."deleted_at" IS NULL OR "planets"."deleted_at" > $1)"#) db.reset() _ = try? Planet.query(on: db).unique().sum(\.$id).wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"SELECT SUM(DISTINCT("planets"."id")) AS "aggregate" FROM "planets" WHERE ("planets"."deleted_at" IS NULL OR "planets"."deleted_at" > $1)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"SELECT SUM(DISTINCT "planets"."id") AS "aggregate" FROM "planets" WHERE ("planets"."deleted_at" IS NULL OR "planets"."deleted_at" > $1)"#) db.reset() } @@ -198,7 +198,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT NOT NULL)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT NOT NULL)"#) } func testIdentifierFieldConstraint() throws { @@ -208,7 +208,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT PRIMARY KEY)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT PRIMARY KEY)"#) db.reset() try db.schema("planets") @@ -216,7 +216,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY)"#) } func testForeignKeyFieldConstraint() throws { @@ -226,7 +226,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT REFERENCES "galaxies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT REFERENCES "galaxies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)"#) db.reset() try db.schema("planets") @@ -234,7 +234,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT REFERENCES "galaxies" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT REFERENCES "galaxies" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)"#) } func testMultipleFieldConstraint() throws { @@ -244,7 +244,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY)"#) } func testUniqueTableConstraint() throws { @@ -255,7 +255,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT, CONSTRAINT "uq:planets.id" UNIQUE ("id"))"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT, CONSTRAINT "uq:planets.id" UNIQUE ("id"))"#) db.reset() try db.schema("planets") @@ -265,7 +265,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("id" BIGINT, "name" TEXT, CONSTRAINT "uq:planets.id+planets.name" UNIQUE ("id", "name"))"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("id" BIGINT, "name" TEXT, CONSTRAINT "uq:planets.id+planets.name" UNIQUE ("id", "name"))"#) } func testForeignKeyTableConstraint() throws { @@ -276,7 +276,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT, CONSTRAINT "fk:planets.galaxy_id+planets.id" FOREIGN KEY ("galaxy_id") REFERENCES "galaxies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT, CONSTRAINT "fk:planets.galaxy_id+planets.id" FOREIGN KEY ("galaxy_id") REFERENCES "galaxies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)"#) db.reset() try db.schema("planets") @@ -290,7 +290,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT, CONSTRAINT "fk:planets.galaxy_id+planets.id" FOREIGN KEY ("galaxy_id") REFERENCES "galaxies" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT, CONSTRAINT "fk:planets.galaxy_id+planets.id" FOREIGN KEY ("galaxy_id") REFERENCES "galaxies" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)"#) db.reset() try db.schema("planets") @@ -304,7 +304,7 @@ final class FluentKitTests: XCTestCase { .create() .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT, "galaxy_name" TEXT, CONSTRAINT "fk:planets.galaxy_id+planets.galaxy_name+planets.id+planets.name" FOREIGN KEY ("galaxy_id", "galaxy_name") REFERENCES "galaxies" ("id", "name") ON DELETE NO ACTION ON UPDATE CASCADE)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT, "galaxy_name" TEXT, CONSTRAINT "fk:planets.galaxy_id+planets.galaxy_name+planets.id+planets.name" FOREIGN KEY ("galaxy_id", "galaxy_name") REFERENCES "galaxies" ("id", "name") ON DELETE NO ACTION ON UPDATE CASCADE)"#) } func testIfNotExistsTableCreate() throws { @@ -316,7 +316,7 @@ final class FluentKitTests: XCTestCase { .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE IF NOT EXISTS "planets"("galaxy_id" BIGINT)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE IF NOT EXISTS "planets" ("galaxy_id" BIGINT)"#) db.reset() try db.schema("planets") @@ -325,7 +325,7 @@ final class FluentKitTests: XCTestCase { .wait() XCTAssertEqual(db.sqlSerializers.count, 1) - XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets"("galaxy_id" BIGINT)"#) + XCTAssertEqual(db.sqlSerializers.first?.sql, #"CREATE TABLE "planets" ("galaxy_id" BIGINT)"#) } func testDecodeWithoutID() throws { @@ -734,7 +734,7 @@ final class FluentKitTests: XCTestCase { _ = try Star.query(on: db).join(AltPlanet.self, on: \AltPlanet.$star.$id == \Star.$id).fields(for: Star.self).withDeleted().first().wait() XCTAssertEqual(db.sqlSerializers.count, 6) - XCTAssertEqual(db.sqlSerializers.dropFirst(0).first?.sql, #"CREATE TABLE "mirror_universe"."planets"("id" UUID PRIMARY KEY, "name" TEXT NOT NULL, "star_id" UUID REFERENCES "stars" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION NOT NULL, "possible_star_id" UUID REFERENCES "stars" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, "createdAt" TIMESTAMPTZ, "updatedAt" TIMESTAMPTZ, "deletedAt" TIMESTAMPTZ DEFAULT NULL)"#) + XCTAssertEqual(db.sqlSerializers.dropFirst(0).first?.sql, #"CREATE TABLE "mirror_universe"."planets" ("id" UUID PRIMARY KEY, "name" TEXT NOT NULL, "star_id" UUID REFERENCES "stars" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION NOT NULL, "possible_star_id" UUID REFERENCES "stars" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, "createdAt" TIMESTAMPTZ, "updatedAt" TIMESTAMPTZ, "deletedAt" TIMESTAMPTZ DEFAULT NULL)"#) XCTAssertEqual(db.sqlSerializers.dropFirst(1).first?.sql, #"SELECT "mirror_universe"."planets"."id" AS "mirror_universe_planets_id", "mirror_universe"."planets"."name" AS "mirror_universe_planets_name", "mirror_universe"."planets"."star_id" AS "mirror_universe_planets_star_id", "mirror_universe"."planets"."possible_star_id" AS "mirror_universe_planets_possible_star_id", "mirror_universe"."planets"."createdAt" AS "mirror_universe_planets_createdAt", "mirror_universe"."planets"."updatedAt" AS "mirror_universe_planets_updatedAt", "mirror_universe"."planets"."deletedAt" AS "mirror_universe_planets_deletedAt" FROM "mirror_universe"."planets" WHERE "mirror_universe"."planets"."name" = $1 AND ("mirror_universe"."planets"."deletedAt" IS NULL OR "mirror_universe"."planets"."deletedAt" > $2)"#) XCTAssertEqual(db.sqlSerializers.dropFirst(2).first?.sql, #"INSERT INTO "mirror_universe"."planets" ("id", "name", "star_id", "possible_star_id", "createdAt", "updatedAt", "deletedAt") VALUES ($1, $2, DEFAULT, DEFAULT, $3, $4, DEFAULT)"#) XCTAssertEqual(db.sqlSerializers.dropFirst(3).first?.sql, #"UPDATE "mirror_universe"."planets" SET "id" = $1, "name" = $2, "updatedAt" = $3 WHERE "mirror_universe"."planets"."id" = $4 AND ("mirror_universe"."planets"."deletedAt" IS NULL OR "mirror_universe"."planets"."deletedAt" > $5)"#)