Generate Vapor project.
This commit is contained in:
14
Sources/stella/Migrations/CreateTodo.swift
Normal file
14
Sources/stella/Migrations/CreateTodo.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
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()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user