19 lines
569 B
Swift
19 lines
569 B
Swift
import Fluent
|
|
|
|
struct CreateUser: AsyncMigration {
|
|
func prepare(on database: any Database) async throws {
|
|
try await database.schema("users")
|
|
.id()
|
|
.field("username", .string, .required)
|
|
.field("email", .string, .required)
|
|
.field("password", .string, .required)
|
|
.field("group", .string, .required)
|
|
.field("is_superuser", .bool, .required)
|
|
.create()
|
|
}
|
|
|
|
func revert(on database: any Database) async throws {
|
|
try await database.schema("users").delete()
|
|
}
|
|
}
|