Skip to content

Commit 4d0ad32

Browse files
committed
Extra test
1 parent 4e10c03 commit 4d0ad32

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

Package.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ let package = Package(
6464
.plugin(
6565
name: "OtterPlugin",
6666
capability: .buildTool(),
67-
// capability: .command(
68-
// intent: .custom(
69-
// verb: "otter", description: "Generates the database queries"
70-
// ),
71-
// permissions: [
72-
// .writeToPackageDirectory(reason: "Writes the queries out to a swift file."),
73-
// ]
74-
// ),
7567
dependencies: ["OtterCLI"]
7668
),
7769

Tests/OtterTests/MigrationRunnerTests.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,31 @@ struct MigrationRunnerTests: ~Copyable {
5151
#expect(value == "first, second, third")
5252
}
5353

54+
@Test func migrationsAreRunIncrementally() async throws {
55+
var migrations = ["CREATE TABLE foo (value TEXT)"]
56+
57+
try MigrationRunner.execute(
58+
migrations: migrations,
59+
connection: connection
60+
)
61+
62+
migrations.append("CREATE TABLE bar (value TEXT)")
63+
64+
try MigrationRunner.execute(
65+
migrations: migrations,
66+
connection: connection
67+
)
68+
69+
// Run again with no new migrations
70+
try MigrationRunner.execute(
71+
migrations: migrations,
72+
connection: connection
73+
)
74+
75+
let _: String? = try query("SELECT * FROM foo") { try $0.fetchOne() }
76+
let _: String? = try query("SELECT * FROM bar") { try $0.fetchOne() }
77+
}
78+
5479
@Test func failedMigrationRollsbackChanges() async throws {
5580
#expect(throws: OtterError.self) {
5681
try MigrationRunner.execute(

0 commit comments

Comments
 (0)