From ecd83b1d70d6d2ed6eb8d86b4580c45bfbb4019d Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Mon, 27 Apr 2026 20:33:25 +0800 Subject: [PATCH] fix: rename device_type enum 'handled' to 'handheld', add image column --- drizzle/0011_rename-handled-to-handheld-add-image.sql | 5 +++++ lib/db/schema/hardware.ts | 3 ++- lib/db/seed.ts | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 drizzle/0011_rename-handled-to-handheld-add-image.sql diff --git a/drizzle/0011_rename-handled-to-handheld-add-image.sql b/drizzle/0011_rename-handled-to-handheld-add-image.sql new file mode 100644 index 0000000..6806c93 --- /dev/null +++ b/drizzle/0011_rename-handled-to-handheld-add-image.sql @@ -0,0 +1,5 @@ +-- Rename pg_enum value from 'handled' to 'handheld' +ALTER TYPE device_type RENAME VALUE 'handled' TO 'handheld'; + +-- Add nullable image column to hardware table +ALTER TABLE hardware ADD COLUMN image text; diff --git a/lib/db/schema/hardware.ts b/lib/db/schema/hardware.ts index 206aef9..f6794f8 100644 --- a/lib/db/schema/hardware.ts +++ b/lib/db/schema/hardware.ts @@ -1,11 +1,12 @@ import { integer, pgEnum, pgTable, text, timestamp } from "drizzle-orm/pg-core" -export const deviceTypeEnum = pgEnum("device_type", ["handled", "console"]) +export const deviceTypeEnum = pgEnum("device_type", ["handheld", "console"]) export const hardware = pgTable("hardware", { slug: text("slug").primaryKey(), name: text("name").notNull(), deviceType: deviceTypeEnum("device_type").notNull(), + image: text("image"), sortOrder: integer("sort_order").default(0).notNull(), createdAt: timestamp("created_at").defaultNow().notNull(), }) diff --git a/lib/db/seed.ts b/lib/db/seed.ts index bf91896..0e37ab4 100644 --- a/lib/db/seed.ts +++ b/lib/db/seed.ts @@ -17,13 +17,13 @@ async function seed() { { slug: "steamdeck-oled", name: "Steam Deck OLED", - deviceType: "handled" as const, + deviceType: "handheld" as const, sortOrder: 0, }, { slug: "steamdeck-lcd", name: "Steam Deck LCD", - deviceType: "handled" as const, + deviceType: "handheld" as const, sortOrder: 1, }, {