feat(db): add performance entries and game platform support schemas

- Create performanceEntries table with FPS metrics, environment details,
  feature flags (FSR, frame gen), load times, settings JSON, and moderation
- Create gamePlatformSupport table with Proton/anti-cheat status enums
  and composite unique constraint on (gameId, hardwareSlug)
- Update schema barrel export to include both new tables
This commit is contained in:
2026-04-25 11:45:49 +08:00
parent 63a6e8b7d6
commit 50f737f686
3 changed files with 114 additions and 3 deletions
+61
View File
@@ -0,0 +1,61 @@
import {
boolean,
pgEnum,
pgTable,
text,
timestamp,
unique,
} from "drizzle-orm/pg-core"
import { games } from "./games"
import { hardware } from "./hardware"
export const protonStatusEnum = pgEnum("proton_status", [
"native",
"proton",
"unsupported",
"unknown",
])
export const antiCheatStatusEnum = pgEnum("anti_cheat_status", [
"none",
"supported",
"unsupported",
"unknown",
])
export const gamePlatformSupport = pgTable(
"game_platform_support",
{
id: text("id")
.primaryKey()
.$defaultFn(() => crypto.randomUUID()),
gameId: text("game_id")
.notNull()
.references(() => games.id, { onDelete: "cascade" }),
hardwareSlug: text("hardware_slug")
.notNull()
.references(() => hardware.slug, { onDelete: "restrict" }),
// Compatibility
isSupported: boolean("is_supported").default(false).notNull(),
protonStatus: protonStatusEnum("proton_status")
.default("unknown")
.notNull(),
// Anti-cheat details
antiCheatRelevant: boolean("anti_cheat_relevant")
.default(false)
.notNull(),
antiCheatName: text("anti_cheat_name"),
antiCheatVersion: text("anti_cheat_version"),
antiCheatStatus: antiCheatStatusEnum("anti_cheat_status")
.default("unknown")
.notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().notNull(),
},
(table) => [
unique("game_hardware_unique").on(table.gameId, table.hardwareSlug),
]
)