Heimdall: Add id column to player session tracking.

This commit is contained in:
Kenneth Endfinger committed 2021-12-24 02:49:53 -05:00
1 parent 1985b3c507
commit 4017c3cb8c
3 files changed
+4 -1

No files matched your search

@@ -15,6 +15,7 @@ class PlayerSession(
override fun store(transaction: Transaction) { override fun store(transaction: Transaction) {
transaction.apply { transaction.apply {
PlayerSessionTable.insert { PlayerSessionTable.insert {
it[id] = UUID.randomUUID()
it[player] = playerUniqueIdentity it[player] = playerUniqueIdentity
it[name] = playerName it[name] = playerName
it[startTime] = startTimeInstant it[startTime] = startTimeInstant
@@ -4,6 +4,7 @@ import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.javatime.timestamp import org.jetbrains.exposed.sql.javatime.timestamp
object PlayerSessionTable : Table("player_sessions") { object PlayerSessionTable : Table("player_sessions") {
val id = uuid("id")
val player = uuid("player") val player = uuid("player")
val name = text("name") val name = text("name")
val startTime = timestamp("start") val startTime = timestamp("start")
@@ -46,11 +46,12 @@ create table if not exists heimdall.block_places (
select create_hypertable('heimdall.block_places', 'time', 'player', 4, if_not_exists => TRUE); select create_hypertable('heimdall.block_places', 'time', 'player', 4, if_not_exists => TRUE);
-- --
create table if not exists heimdall.player_sessions ( create table if not exists heimdall.player_sessions (
id uuid not null,
player uuid not null, player uuid not null,
name text not null, name text not null,
"start" timestamp not null, "start" timestamp not null,
"end" timestamp not null, "end" timestamp not null,
PRIMARY KEY (player, start) primary key (id, player, start)
); );
-- --
select create_hypertable('heimdall.player_sessions', 'start', 'player', 4, if_not_exists => TRUE); select create_hypertable('heimdall.player_sessions', 'start', 'player', 4, if_not_exists => TRUE);