feat: Updates database client migrations to be called as a function.
This commit is contained in:
@@ -66,7 +66,7 @@ private func setupDatabase(
|
|||||||
let databaseClient = makeDatabaseClient(app.db)
|
let databaseClient = makeDatabaseClient(app.db)
|
||||||
|
|
||||||
if app.environment != .testing {
|
if app.environment != .testing {
|
||||||
try await app.migrations.add(databaseClient.migrations.run())
|
try await app.migrations.add(databaseClient.migrations())
|
||||||
}
|
}
|
||||||
|
|
||||||
return databaseClient
|
return databaseClient
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ extension DatabaseClient {
|
|||||||
@DependencyClient
|
@DependencyClient
|
||||||
public struct Migrations: Sendable {
|
public struct Migrations: Sendable {
|
||||||
public var run: @Sendable () async throws -> [any AsyncMigration]
|
public var run: @Sendable () async throws -> [any AsyncMigration]
|
||||||
|
|
||||||
|
public func callAsFunction() async throws -> [any AsyncMigration] {
|
||||||
|
try await self.run()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user