From b3c6c27a96916f90aa16fe6ac3904a6db628deb9 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Mon, 26 Jan 2026 11:13:29 -0500 Subject: [PATCH] feat: Updates database client migrations to be called as a function. --- Sources/App/configure.swift | 2 +- Sources/DatabaseClient/Interface.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index 115153c..71f4d6e 100644 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -66,7 +66,7 @@ private func setupDatabase( let databaseClient = makeDatabaseClient(app.db) if app.environment != .testing { - try await app.migrations.add(databaseClient.migrations.run()) + try await app.migrations.add(databaseClient.migrations()) } return databaseClient diff --git a/Sources/DatabaseClient/Interface.swift b/Sources/DatabaseClient/Interface.swift index b003db9..7fe5073 100644 --- a/Sources/DatabaseClient/Interface.swift +++ b/Sources/DatabaseClient/Interface.swift @@ -55,6 +55,10 @@ extension DatabaseClient { @DependencyClient public struct Migrations: Sendable { public var run: @Sendable () async throws -> [any AsyncMigration] + + public func callAsFunction() async throws -> [any AsyncMigration] { + try await self.run() + } } }