feat: Updates database client migrations to be called as a function.

This commit is contained in:
2026-01-26 11:13:29 -05:00
parent 0fe80d05c6
commit b3c6c27a96
2 changed files with 5 additions and 1 deletions

View File

@@ -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

View File

@@ -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()
}
} }
} }