feat(db): add core Drizzle schema tables (hardware, games, gameVersions)
- Create lib/db/schema/ directory with barrel export index.ts - Add hardware table with device_type enum (handled/console) - Add games table with Steam metadata, sync fields, and JSON genres - Add game_versions table with composite unique (gameId, buildId) and cascade delete Refs: Chunk 2 of database schema implementation
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
boolean,
|
||||
integer,
|
||||
jsonb,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
} from "drizzle-orm/pg-core"
|
||||
|
||||
export const games = pgTable("games", {
|
||||
id: text("id")
|
||||
.primaryKey()
|
||||
.$defaultFn(() => crypto.randomUUID()),
|
||||
steamAppId: integer("steam_app_id").unique().notNull(),
|
||||
title: text("title").notNull(),
|
||||
description: text("description"),
|
||||
publisher: text("publisher"),
|
||||
developer: text("developer"),
|
||||
genres: jsonb("genres").$type<string[]>(),
|
||||
headerImage: text("header_image"),
|
||||
capsuleImage: text("capsule_image"),
|
||||
storeUrl: text("store_url"),
|
||||
lastSync: timestamp("last_sync"),
|
||||
syncStatus: text("sync_status").default("pending"),
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updated_at").defaultNow().notNull(),
|
||||
})
|
||||
Reference in New Issue
Block a user