impl Account Table
This commit is contained in:
21
Sources/stella/Migrations/CreateAccount.swift
Normal file
21
Sources/stella/Migrations/CreateAccount.swift
Normal file
@@ -0,0 +1,21 @@
|
||||
import Fluent
|
||||
|
||||
struct CreateAccount: AsyncMigration {
|
||||
func prepare(on database: any Database) async throws {
|
||||
try await database.schema("accounts")
|
||||
.field("id", .int, .identifier(auto: true))
|
||||
.field("app_id", .string, .required)
|
||||
.field("first_login_time", .date, .required)
|
||||
.field("idp_alias", .string, .required)
|
||||
.field("idp_code", .string, .required)
|
||||
.field("idp_id", .string, .required)
|
||||
.field("reg_time", .date, .required)
|
||||
.field("last_login_time", .date, .required)
|
||||
.field("status", .string, .required)
|
||||
.create()
|
||||
}
|
||||
|
||||
func revert(on database: any Database) async throws {
|
||||
try await database.schema("accounts").delete()
|
||||
}
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
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