feat: Initial commit
This commit is contained in:
19
Sources/App/Migrations/CreateProCon.swift
Normal file
19
Sources/App/Migrations/CreateProCon.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
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()
|
||||
}
|
||||
|
||||
}
|
||||
16
Sources/App/Migrations/CreateUser.swift
Normal file
16
Sources/App/Migrations/CreateUser.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
struct CreateUser: AsyncMigration {
|
||||
func prepare(on database: Database) async throws {
|
||||
try await database.schema("user")
|
||||
.id()
|
||||
.field("displayName", .string, .required)
|
||||
.create()
|
||||
}
|
||||
|
||||
func revert(on database: Database) async throws {
|
||||
try await database.schema("user").delete()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user