import FluentKit /// Creates and drops the `example_records` table backing ``ExampleRecord``. /// /// Reference scaffolding paired with ``ExampleRecord``; replace it with the first real migration once a /// domain model is defined. Migrations are append-only in production — add a new migration to alter the /// schema rather than editing one that has already run. struct CreateExampleRecord: AsyncMigration { // MARK: Methods /// Creates the `example_records` table with an `id` primary key and a required `name` column. /// - Parameter database: the database the schema change is applied to. func prepare(on database: Database) async throws { try await database.schema(ExampleRecord.schema) .id() .field("name", .string, .required) .create() } /// Drops the `example_records` table, reverting ``prepare(on:)``. /// - Parameter database: the database the schema change is applied to. func revert(on database: Database) async throws { try await database.schema(ExampleRecord.schema) .delete() } }