fix: rename device_type enum 'handled' to 'handheld', add image column

This commit is contained in:
2026-04-27 20:33:25 +08:00
parent de858081e0
commit ecd83b1d70
3 changed files with 9 additions and 3 deletions
@@ -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;
+2 -1
View File
@@ -1,11 +1,12 @@
import { integer, pgEnum, pgTable, text, timestamp } from "drizzle-orm/pg-core" 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", { export const hardware = pgTable("hardware", {
slug: text("slug").primaryKey(), slug: text("slug").primaryKey(),
name: text("name").notNull(), name: text("name").notNull(),
deviceType: deviceTypeEnum("device_type").notNull(), deviceType: deviceTypeEnum("device_type").notNull(),
image: text("image"),
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(),
}) })
+2 -2
View File
@@ -17,13 +17,13 @@ async function seed() {
{ {
slug: "steamdeck-oled", slug: "steamdeck-oled",
name: "Steam Deck OLED", name: "Steam Deck OLED",
deviceType: "handled" as const, deviceType: "handheld" as const,
sortOrder: 0, sortOrder: 0,
}, },
{ {
slug: "steamdeck-lcd", slug: "steamdeck-lcd",
name: "Steam Deck LCD", name: "Steam Deck LCD",
deviceType: "handled" as const, deviceType: "handheld" as const,
sortOrder: 1, sortOrder: 1,
}, },
{ {