Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

40 строки
909 B

  1. //
  2. // mdlLicense.swift
  3. //
  4. //
  5. // Created by Michiel Carman on 4/5/24.
  6. //
  7. import Vapor
  8. import Fluent
  9. final class mdlLicense: Model{
  10. static let schema = "license"
  11. @ID(custom: "id", generatedBy: .database) var id: Int?
  12. @Field(key: "expires") var expires: Date
  13. init(){}
  14. init(id: Int?, expires: Date){
  15. self.id = id!
  16. self.expires = expires
  17. }
  18. }
  19. extension mdlLicense{
  20. struct Create: AsyncMigration{
  21. func prepare(on database: FluentKit.Database) async throws {
  22. try await database.schema(mdlLicense.schema)
  23. .field("id", .int, .identifier(auto: true))
  24. .field("expires", .datetime)
  25. .create()
  26. }
  27. func revert(on database: FluentKit.Database) async throws {
  28. try await database.schema(mdlLicense.schema)
  29. .delete()
  30. }
  31. }
  32. }