// // CompartmentLocation.swift // // // Created by Michiel Carman on 1/24/24. // import Fluent import Vapor import Foundation import FluentKit final class mdlCompartmentLocation: Model, Content { static let schema = "compartmentLocation" @ID(custom: "id", generatedBy: .database) var id: Int? @Field(key: "name") var name: String? @Field(key: "description") var description: String? @Field(key: "code") var code: String? @Field(key: "sortOrder") var sortorder: Int? @Field(key: "isActive") var isactive: Bool? @Timestamp(key: "createDate", on: .create) var createdate: Date? @Field(key: "createUserId") var createuserid: Int? @Timestamp(key: "updateDate", on: .update) var updatedate: Date? @Field(key: "updateUserId") var updateuserid: Int? init() { } init(id: Int? = nil, name: String? = nil, description: String? = nil, code: String? = nil, sortorder: Int?, isactive: Bool?, createuserid: Int? = nil, updateuserid: Int? = nil) { self.id = id self.name = name self.description = description self.code = code self.sortorder = sortorder self.isactive = isactive self.createuserid = createuserid self.updateuserid = updateuserid } } extension mdlCompartmentLocation{ struct Create: AsyncMigration { func prepare(on database: Database) async throws { try await database.schema("compartmentLocation") .field("id", .int, .identifier(auto: true)) .field("name", .string) .field("description", .string) .field("code", .string) .field("sortOrder", .int) .field("isActive", .bool) .field("createDate", .datetime) .field("createUserId", .int) .field("updateDate", .datetime) .field("updateUserId", .int) .create() } func revert(on database: Database) async throws { try await database.schema("compartmentLocation").delete() } } }