Added the catalogue models and seed to support phase 2 of the POC prototype in the Persistence package.

This commit is contained in:
javier committed 2026-09-21 11:44:41 +02:00
1 parent ea89ea892a
commit 09c7b8a1a7
10 files changed
+238 -21

No files matched your search

@@ -0,0 +1,26 @@
import FluentKit
/// Creates and drops the `users` table backing ``UserRecord``, seeded with the prototype's demo accounts.
struct CreateUser: AsyncMigration {
// MARK: Methods
func prepare(on database: Database) async throws {
try await database.schema(UserRecord.schema)
.id()
.field("email", .string, .required)
.field("display_name", .string, .required)
.unique(on: "email")
.create()
for account in Seed.accounts {
try await UserRecord(email: account.email, displayName: account.displayName).save(on: database)
}
}
func revert(on database: Database) async throws {
try await database.schema(UserRecord.schema)
.delete()
}
}