Skip to content

Commit aa2e778

Browse files
authored
renamed checkForDuplicates to skipDuplicates (#46)
* renamed checkForDuplicates to skipDuplicates * Fixing documentation * revert document stuff * revert document comments change
1 parent 08e029d commit aa2e778

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Sources/PostgresMigrations/Migrations.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public actor DatabaseMigrations {
3737
/// Add migration to list of migrations to be be applied
3838
/// - Parameters
3939
/// - migration: DatabaseMigration to be applied
40-
/// - checkForDuplicates: Only add migration if it doesn't exist in the list
41-
public func add(_ migration: DatabaseMigration, checkForDuplicates: Bool = false) {
42-
if checkForDuplicates {
40+
/// - skipDuplicates: Only add migration if it doesn't exist in the list
41+
public func add(_ migration: DatabaseMigration, skipDuplicates: Bool = false) {
42+
if skipDuplicates {
4343
let existingMigration = self.migrations.first {
4444
type(of: $0) == type(of: migration)
4545
}
@@ -53,7 +53,6 @@ public actor DatabaseMigrations {
5353
/// This is useful for migrations you might have to revert.
5454
/// - Parameter migration: DatabaseMigration to be registerd
5555
public func register(_ migration: DatabaseMigration) {
56-
5756
self.reverts[migration.name] = migration
5857
}
5958

Tests/PostgresMigrationsTests/MigrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ final class MigrationTests: XCTestCase {
153153
let order = TestOrderMigration.Order()
154154
try await self.testMigrations { migrations in
155155
await migrations.add(TestOrderMigration(name: "test1", order: order, applyOrder: 1))
156-
await migrations.add(TestOrderMigration(name: "test1", order: order, applyOrder: 1), checkForDuplicates: true)
156+
await migrations.add(TestOrderMigration(name: "test1", order: order, applyOrder: 1), skipDuplicates: true)
157157
} verify: { migrations, client in
158158
try await migrations.apply(client: client, groups: [.default], logger: Self.logger, dryRun: false)
159159
order.expect(2)

0 commit comments

Comments
 (0)