File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ public extension Database {
6969 }
7070
7171 /// Runs the migrations up to and including the `maxMigration`.
72+ ///
73+ /// The `maxMigration` number is not equal to the filename, but
74+ /// rather the zero based index.
7275 func migrate( upTo maxMigration: Int ? = nil ) async throws {
7376 try await connection. withConnection ( isWrite: true ) { conn in
7477 try MigrationRunner . execute (
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ enum MigrationRunner {
1414 connection: RawConnection ,
1515 upTo maxMigration: Int ? = nil
1616 ) throws {
17- let previouslyRunMigrations = try runMigrations ( connection: connection)
17+ let previouslyRunMigrations = try getRanMigrations ( connection: connection)
1818 let lastMigration = previouslyRunMigrations. last ?? Int . min
1919
2020 let pendingMigrations = migrations. enumerated ( )
@@ -56,7 +56,7 @@ enum MigrationRunner {
5656 }
5757
5858 /// Creates the migrations table and gets the last migration that ran.
59- private static func runMigrations ( connection: RawConnection ) throws -> [ Int ] {
59+ private static func getRanMigrations ( connection: RawConnection ) throws -> [ Int ] {
6060 let tx = try Transaction ( connection: connection, kind: . write)
6161
6262 // Create the migration table if need be.
You can’t perform that action at this time.
0 commit comments