Added the catalogue models and seed to support phase 1 of the POC prototype in the Persistence package.
This commit is contained in:
1 parent
717df5208c
commit
6d7ab4bcba
19 files changed
+1381
-151
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import FluentKit
|
||||
|
||||
/// Creates and drops the `listings` table backing ``ListingRecord``.
|
||||
struct CreateListing: AsyncMigration {
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
func prepare(on database: Database) async throws {
|
||||
try await database.schema(ListingRecord.schema)
|
||||
.id()
|
||||
.field("shop_id", .uuid, .required, .references(ShopRecord.schema, "id", onDelete: .cascade))
|
||||
.field("slug", .string, .required)
|
||||
.field("title", .string, .required)
|
||||
.field("series_title", .string, .required)
|
||||
.field("issue_label", .string, .required)
|
||||
.field("publisher", .string, .required)
|
||||
.field("year", .int, .required)
|
||||
.field("format", .string, .required)
|
||||
.field("printing", .string, .required)
|
||||
.field("printing_detail", .string, .required)
|
||||
.field("is_first_print", .bool, .required)
|
||||
.field("grader", .string)
|
||||
.field("grade", .double)
|
||||
.field("condition", .string, .required)
|
||||
.field("cert_number", .string)
|
||||
.field("page_quality", .string)
|
||||
.field("key_notes", .string)
|
||||
.field("seller_notes", .string, .required)
|
||||
.field("price_cents", .int, .required)
|
||||
.field("shipping_cents", .int, .required)
|
||||
.field("accepts_offers", .bool, .required)
|
||||
.field("cover_tone", .string, .required)
|
||||
.field("cover_title", .string, .required)
|
||||
.field("cover_imprint", .string, .required)
|
||||
.field("cover_number", .string, .required)
|
||||
.field("listed_at", .datetime, .required)
|
||||
.unique(on: "slug")
|
||||
.create()
|
||||
}
|
||||
|
||||
func revert(on database: Database) async throws {
|
||||
try await database.schema(ListingRecord.schema)
|
||||
.delete()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user