Files
procons/Sources/App/Migrations/CreateProCon.swift
2024-12-31 17:02:29 -05:00

20 lines
458 B
Swift

import Fluent
import Vapor
struct CreateProCon: AsyncMigration {
func prepare(on database: Database) async throws {
try await database.schema("procon")
.id()
.field("description", .string, .required)
.field("type", .string, .required)
.field("userId", .uuid, .required, .references("user", "id"))
.create()
}
func revert(on database: Database) async throws {
try await database.schema("procon").delete()
}
}