Added the catalogue models and seed to support phase 2 of the POC prototype in the Persistence package.
This commit is contained in:
1 parent
ea89ea892a
commit
09c7b8a1a7
10 files changed
+238
-21
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import HummingbirdFluent
|
||||
import Logging
|
||||
|
||||
@testable import Persistence
|
||||
|
||||
/// Runs the body against a migrated, seeded in-memory database, shutting the pool down after — even on failure, or the pool asserts on `deinit`.
|
||||
func withDatabase(
|
||||
_ body: (Fluent) async throws -> Void
|
||||
) async throws {
|
||||
let fluent = try Service(
|
||||
driver: .inMemory,
|
||||
logger: Logger(label: "test")
|
||||
)()
|
||||
|
||||
do {
|
||||
await PrepareDB()(for: fluent)
|
||||
|
||||
try await fluent.migrate()
|
||||
try await body(fluent)
|
||||
} catch {
|
||||
try? await fluent.shutdown()
|
||||
|
||||
throw error
|
||||
}
|
||||
|
||||
try await fluent.shutdown()
|
||||
}
|
||||
Reference in new issue
Block a user