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

This commit is contained in:
javier committed 2026-09-21 11:16:30 +02:00
1 parent 717df5208c
commit 6d7ab4bcba
19 files changed
+1381 -151

No files matched your search

@@ -0,0 +1,33 @@
import FluentKit
/// Creates and drops the `shops` table backing ``ShopRecord``.
struct CreateShop: AsyncMigration {
// MARK: Methods
func prepare(on database: Database) async throws {
try await database.schema(ShopRecord.schema)
.id()
.field("slug", .string, .required)
.field("name", .string, .required)
.field("city", .string, .required)
.field("country", .string, .required)
.field("since_year", .int, .required)
.field("is_verified", .bool, .required)
.field("rating", .double, .required)
.field("rated_sales", .int, .required)
.field("sold_count", .int, .required)
.field("handling_days", .int, .required)
.field("ships_note", .string, .required)
.field("returns_note", .string, .required)
.field("about", .string, .required)
.unique(on: "slug")
.create()
}
func revert(on database: Database) async throws {
try await database.schema(ShopRecord.schema)
.delete()
}
}