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:
1 parent
e0524da525
commit
3a3d2619ad
6 files changed
+77
-32
No files matched your search
@@ -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 {}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user