15 lines
366 B
Swift
15 lines
366 B
Swift
import Fluent
|
|
|
|
struct CreateTodo: AsyncMigration {
|
|
func prepare(on database: any Database) async throws {
|
|
try await database.schema("todos")
|
|
.id()
|
|
.field("title", .string, .required)
|
|
.create()
|
|
}
|
|
|
|
func revert(on database: any Database) async throws {
|
|
try await database.schema("todos").delete()
|
|
}
|
|
}
|