Added the catalogue models and seed to support phase 3 of the POC prototype in the Persistence package.
This commit is contained in:
1 parent
43dcc03da6
commit
b1ceed7790
20 files changed
+2035
-8
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import FluentKit
|
||||
|
||||
/// Adds an owner to shops and a sold date to listings.
|
||||
///
|
||||
/// Registered ahead of ``SeedCatalogue``, whose models write both columns. The owner carries no foreign key: on a fresh database the
|
||||
/// `users` table does not exist yet at this point.
|
||||
struct AddTradeColumns: AsyncMigration {
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
func prepare(on database: Database) async throws {
|
||||
try await database.schema(ShopRecord.schema)
|
||||
.field("owner_id", .uuid)
|
||||
.update()
|
||||
try await database.schema(ListingRecord.schema)
|
||||
.field("sold_at", .datetime)
|
||||
.update()
|
||||
}
|
||||
|
||||
func revert(on database: Database) async throws {
|
||||
try await database.schema(ListingRecord.schema)
|
||||
.deleteField("sold_at")
|
||||
.update()
|
||||
try await database.schema(ShopRecord.schema)
|
||||
.deleteField("owner_id")
|
||||
.update()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user