CreateTodo.swift 358 B

1234567891011121314
  1. import Fluent
  2. struct CreateTodo: AsyncMigration {
  3. func prepare(on database: Database) async throws {
  4. try await database.schema("todos")
  5. .id()
  6. .field("title", .string, .required)
  7. .create()
  8. }
  9. func revert(on database: Database) async throws {
  10. try await database.schema("todos").delete()
  11. }
  12. }