s6-0day/source/Sources/App/Migrations/CreatePosts.swift

27 lines
731 B
Swift
Raw Normal View History

2022-11-18 09:06:38 +01:00
//
// CreatePosts.swift
//
//
// Created by hdesk on 04/10/22.
//
import Fluent
struct CreatePosts: AsyncMigration {
func prepare(on database: Database) async throws {
try await database.schema("exploits")
.field("id", .uuid, .required, .sql(raw: "UNIQUE"))
.field("content", .string, .required)
.field("title", .string, .required)
.field("created_by", .string, .required)
.field("created_at", .int, .required)
.field("public", .bool, .required)
.field("whitelist", .string, .required)
.create()
}
func revert(on database: Database) async throws {
try await database.schema("users").delete()
}
}