Track traffic by game month

This commit is contained in:
2026-07-27 11:32:48 +00:00
parent 9f402a3d67
commit 2b15410c5c
9 changed files with 595 additions and 146 deletions
+34
View File
@@ -97,6 +97,8 @@ model WorldState {
meta Json @default(dbgenerated("'{}'::jsonb"))
updatedAt DateTime @updatedAt @map("updated_at")
trafficPeriods TrafficPeriod[]
@@map("world_state")
}
@@ -204,6 +206,38 @@ model GeneralAccessLog {
@@map("general_access_log")
}
model TrafficPeriod {
id Int @id @default(autoincrement())
worldStateId Int @map("world_state_id")
year Int
month Int
startedAt DateTime @map("started_at")
lastRefresh DateTime @map("last_refresh")
refresh Int @default(0)
online Int @default(0)
worldState WorldState @relation(fields: [worldStateId], references: [id], onDelete: Cascade)
generals TrafficPeriodGeneral[]
@@unique([worldStateId, year, month])
@@index([worldStateId, startedAt])
@@map("traffic_period")
}
model TrafficPeriodGeneral {
periodId Int @map("period_id")
generalId Int @map("general_id")
userId String? @map("user_id")
refresh Int @default(0)
lastRefresh DateTime @map("last_refresh")
period TrafficPeriod @relation(fields: [periodId], references: [id], onDelete: Cascade)
@@id([periodId, generalId])
@@index([periodId, refresh, generalId])
@@map("traffic_period_general")
}
model MessageReadState {
generalId Int @id @map("general_id")
latestPrivateMessage Int @default(0) @map("latest_private_message")