Move sessions to db table instead of JWTs

This commit is contained in:
Andrew Glaze
2025-05-23 11:52:06 -04:00
parent 62260ffc73
commit 49cd62da1d
11 changed files with 114 additions and 101 deletions

View File

@@ -27,13 +27,13 @@ struct CreatePlayers: AsyncMigration {
.field("free_mana", .int, .required)
.field("paid_mana", .int, .required)
.field("enable_auto_3x", .bool, .required)
.field("account_id", .int, .required)
.field("account_id", .int, .required, .references("accounts", "id"))
.field("tutorial_step", .int, .required)
.field("tutorial_skip_flag", .int, .required)
.create()
}
func revert(on database: any Database) async throws {
try await database.schema("players").delete()
}
}

View File

@@ -0,0 +1,16 @@
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()
}
}