Files
Stella/Sources/stella/Migrations/CreateSessions.swift
2025-05-23 11:52:06 -04:00

17 lines
549 B
Swift

import Fluent
struct CreateSessions: AsyncMigration {
func prepare(on database: any Database) async throws {
try await database.schema("sessions")
.field("token", .string, .identifier(auto: false))
.field("type", .int, .required)
.field("expires", .datetime, .required)
.field("accountId", .int, .required, .references("accounts", "id"))
.create()
}
func revert(on database: any Database) async throws {
try await database.schema("sessions").delete()
}
}