Dated the demo cons in the Persistence package from the weekend after seeding, and re-dated the ones already seeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javierandClaude Opus 5.5 committed 2026-10-25 12:47:23 +01:00
1 parent e0524da525
commit 3a3d2619ad
6 files changed
+77 -32

No files matched your search

@@ -29,7 +29,7 @@ struct CreateCommunity: AsyncMigration {
.unique(on: "user_id", "series_slug", "issue")
.create()
for (event, shops) in Seed.events {
for (event, shops) in Seed.events(after: .init()) {
let record = EventRecord(event)
try await record.save(on: database)
@@ -0,0 +1,21 @@
import FluentKit
import Foundation
/// Re-dates the demo cons from the first weekend after it runs, for databases seeded when ``CreateCommunity`` used fixed dates.
struct RedateEvents: AsyncMigration {
// MARK: Methods
func prepare(on database: Database) async throws {
for (event, _) in Seed.events(after: .init()) {
try await EventRecord.query(on: database)
.filter(\.$slug == event.slug)
.set(\.$startsOn, to: event.startsOn)
.set(\.$endsOn, to: event.endsOn)
.update()
}
}
func revert(on database: Database) async throws {}
}