Move sessions to db table instead of JWTs
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
16
Sources/stella/Migrations/CreateSessions.swift
Normal file
16
Sources/stella/Migrations/CreateSessions.swift
Normal 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()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user