feat: add entryScreenshots table, wattHours/tdpMax on hardware, tdpWatts/youtubeVideoId on performanceEntries
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
import {
|
||||||
|
integer,
|
||||||
|
pgTable,
|
||||||
|
text,
|
||||||
|
timestamp,
|
||||||
|
index,
|
||||||
|
} from "drizzle-orm/pg-core"
|
||||||
|
import { performanceEntries } from "./performanceEntries"
|
||||||
|
|
||||||
|
export const entryScreenshots = pgTable(
|
||||||
|
"entry_screenshots",
|
||||||
|
{
|
||||||
|
id: text("id")
|
||||||
|
.primaryKey()
|
||||||
|
.$defaultFn(() => crypto.randomUUID()),
|
||||||
|
entryId: text("entry_id")
|
||||||
|
.notNull()
|
||||||
|
.references(() => performanceEntries.id, { onDelete: "cascade" }),
|
||||||
|
storageKey: text("storage_key").notNull(),
|
||||||
|
orderIndex: integer("order_index").notNull().default(0),
|
||||||
|
mimeType: text("mime_type").notNull(),
|
||||||
|
width: integer("width").notNull(),
|
||||||
|
height: integer("height").notNull(),
|
||||||
|
originalName: text("original_name"),
|
||||||
|
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||||
|
},
|
||||||
|
(table) => [
|
||||||
|
index("entry_screenshots_entry_idx").on(table.entryId),
|
||||||
|
],
|
||||||
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { integer, pgEnum, pgTable, text, timestamp } from "drizzle-orm/pg-core"
|
import { integer, pgEnum, pgTable, real, text, timestamp } from "drizzle-orm/pg-core"
|
||||||
|
|
||||||
export const deviceTypeEnum = pgEnum("device_type", ["handheld", "console"])
|
export const deviceTypeEnum = pgEnum("device_type", ["handheld", "console"])
|
||||||
|
|
||||||
@@ -7,6 +7,8 @@ export const hardware = pgTable("hardware", {
|
|||||||
name: text("name").notNull(),
|
name: text("name").notNull(),
|
||||||
deviceType: deviceTypeEnum("device_type").notNull(),
|
deviceType: deviceTypeEnum("device_type").notNull(),
|
||||||
image: text("image"),
|
image: text("image"),
|
||||||
|
wattHours: real("watt_hours"),
|
||||||
|
tdpMax: real("tdp_max"),
|
||||||
sortOrder: integer("sort_order").default(0).notNull(),
|
sortOrder: integer("sort_order").default(0).notNull(),
|
||||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ export * from "./reports"
|
|||||||
export * from "./community-suggestions"
|
export * from "./community-suggestions"
|
||||||
export * from "./saved-filters"
|
export * from "./saved-filters"
|
||||||
export * from "./storage"
|
export * from "./storage"
|
||||||
|
export * from "./entryScreenshots"
|
||||||
|
|||||||
@@ -79,9 +79,15 @@ export const performanceEntries = pgTable(
|
|||||||
settingsJson: jsonb("settings_json").$type<GameSettingCategory[]>(),
|
settingsJson: jsonb("settings_json").$type<GameSettingCategory[]>(),
|
||||||
userNotes: text("user_notes"),
|
userNotes: text("user_notes"),
|
||||||
|
|
||||||
// Battery estimate (minutes)
|
// Battery estimate (minutes) — @deprecated: auto-computed from tdpWatts + hardware.wattHours
|
||||||
estimatedBatteryMin: integer("estimated_battery_min"),
|
estimatedBatteryMin: integer("estimated_battery_min"),
|
||||||
|
|
||||||
|
// TDP tracking (watts) — user-set TDP cap during benchmark
|
||||||
|
tdpWatts: real("tdp_watts"),
|
||||||
|
|
||||||
|
// YouTube video linking
|
||||||
|
youtubeVideoId: text("youtube_video_id"),
|
||||||
|
|
||||||
// Custom system flag
|
// Custom system flag
|
||||||
customSystem: boolean("custom_system").default(false).notNull(),
|
customSystem: boolean("custom_system").default(false).notNull(),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user