feat(db): move auth schema into Drizzle structure and add user FK

- Move auth schema from auth-schema.ts to lib/db/schema/auth.ts
- Export auth tables (user, session, account, verification, passkey) via barrel
- Add FK from performanceEntries.userId to user.id
- Generate and apply migration for auth tables + user FK
- Remove unused echarts dependency
This commit is contained in:
2026-04-25 12:29:42 +08:00
parent ab0fe349a1
commit 78079779c9
6 changed files with 266 additions and 1 deletions
+4 -1
View File
@@ -8,6 +8,7 @@ import {
} from "drizzle-orm/pg-core"
import { gameVersions } from "./gameVersions"
import { hardware } from "./hardware"
import { user } from "./auth"
export const performanceEntries = pgTable("performance_entries", {
id: text("id")
@@ -19,7 +20,9 @@ export const performanceEntries = pgTable("performance_entries", {
hardwareSlug: text("hardware_slug")
.notNull()
.references(() => hardware.slug, { onDelete: "restrict" }),
userId: text("user_id").notNull(),
userId: text("user_id")
.notNull()
.references(() => user.id, { onDelete: "cascade" }),
// Performance metrics
fpsAvg: real("fps_avg").notNull(),