ImportEvents
struct ImportEvents : AsyncMigration
A Migration
that imports the event schedule from a schedule.ics
file
located in the seeds/
subdirectory of the project.
-
prepare(on:
Asynchronous) Required by
Migration
protocol. Reads either a test or production.ics
file in theseeds/
subdirectory, converts the lines into elements of an array, hands that off to a parser and populates theEvent
database with the[Event]
array returned.Requires
schedule.ics
file in seeds subdirectory.Declaration
Swift
func prepare(on database: Database) async throws
Parameters
database
A connection to the database, provided automatically.
Return Value
Void.
-
revert(on:
Asynchronous) Required by
Migration
protocol. Deletes all schedule events in the database. Running this migration revert should delete allEventFavorite
s, but won’t delete EventForum
s.Declaration
Swift
func revert(on database: Database) async throws
Parameters
database
A connection to the database, provided automatically.
Return Value
Void.