feat(schema): replace FSR/FrameGen booleans with enums, add verification fields to performanceEntries

This commit is contained in:
2026-04-25 18:19:20 +08:00
parent 3da593e619
commit a31b5ea130
+36 -5
View File
@@ -1,16 +1,33 @@
import { import {
boolean, boolean,
jsonb, jsonb,
pgEnum,
pgTable, pgTable,
real, real,
text, text,
timestamp, timestamp,
index,
} from "drizzle-orm/pg-core" } from "drizzle-orm/pg-core"
import { gameVersions } from "./gameVersions" import { gameVersions } from "./gameVersions"
import { hardware } from "./hardware" import { hardware } from "./hardware"
import { user } from "./auth" import { user } from "./auth"
export const performanceEntries = pgTable("performance_entries", { export const fsrVersionEnum = pgEnum("fsr_version", [
"none",
"fsr1",
"fsr2",
"fsr3",
])
export const frameGenMethodEnum = pgEnum("frame_gen_method", [
"none",
"fsr_fg",
"dlss_fg",
])
export const performanceEntries = pgTable(
"performance_entries",
{
id: text("id") id: text("id")
.primaryKey() .primaryKey()
.$defaultFn(() => crypto.randomUUID()), .$defaultFn(() => crypto.randomUUID()),
@@ -33,9 +50,11 @@ export const performanceEntries = pgTable("performance_entries", {
protonVersion: text("proton_version"), protonVersion: text("proton_version"),
osVersion: text("os_version"), osVersion: text("os_version"),
// Feature flags // Upscaler tracking (replaces isFsrEnabled boolean)
isFsrEnabled: boolean("is_fsr_enabled").default(false).notNull(), fsrVersion: fsrVersionEnum("fsr_version").default("none").notNull(),
isFrameGenEnabled: boolean("is_frame_gen_enabled").default(false).notNull(), frameGenMethod: frameGenMethodEnum("frame_gen_method")
.default("none")
.notNull(),
// Load times (seconds) // Load times (seconds)
loadTimeSsd: real("load_time_ssd"), loadTimeSsd: real("load_time_ssd"),
@@ -49,6 +68,18 @@ export const performanceEntries = pgTable("performance_entries", {
isRemoved: boolean("is_removed").default(false).notNull(), isRemoved: boolean("is_removed").default(false).notNull(),
removedReason: text("removed_reason"), removedReason: text("removed_reason"),
// Verification (admin/mod workflow)
verifiedAt: timestamp("verified_at"),
verifiedBy: text("verified_by").references(() => user.id, {
onDelete: "set null",
}),
createdAt: timestamp("created_at").defaultNow().notNull(), createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().notNull(), updatedAt: timestamp("updated_at").defaultNow().notNull(),
}) },
(table) => [
index("perf_hardware_fsr_idx").on(table.hardwareSlug, table.fsrVersion),
index("perf_version_idx").on(table.versionId),
index("perf_user_idx").on(table.userId),
],
)