refactor: remove communityPresets schema, API, and routes

This commit is contained in:
2026-04-27 14:29:30 +08:00
parent 5100888216
commit 07467a4812
9 changed files with 1677 additions and 211 deletions
-53
View File
@@ -1,53 +0,0 @@
import {
integer,
jsonb,
pgTable,
text,
timestamp,
unique,
} from "drizzle-orm/pg-core"
import { games } from "./games"
import { hardware } from "./hardware"
import { performanceEntries } from "./performanceEntries"
import { user } from "./auth"
export const communityPresets = pgTable(
"community_presets",
{
id: text("id")
.primaryKey()
.$defaultFn(() => crypto.randomUUID()),
gameId: text("game_id")
.notNull()
.references(() => games.id, { onDelete: "cascade" }),
hardwareSlug: text("hardware_slug")
.notNull()
.references(() => hardware.slug, { onDelete: "restrict" }),
name: text("name").notNull(),
description: text("description"),
createdBy: text("created_by").references(() => user.id, {
onDelete: "set null",
}),
upvotes: integer("upvotes").default(0).notNull(),
performanceEntryId: text("performance_entry_id").references(
() => performanceEntries.id,
{ onDelete: "set null" },
),
// Freeform settings JSON — same flexible structure as performanceEntries.settingsJson
settingsJson: jsonb("settings_json").$type<
{
category: string
settings: { title: string; value: string | number | boolean }[]
}[]
>(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().notNull(),
},
(table) => [
unique("preset_game_hardware_name_unique").on(
table.gameId,
table.hardwareSlug,
table.name,
),
],
)
-1
View File
@@ -5,6 +5,5 @@ export * from "./gameVersions"
export * from "./hardware"
export * from "./performanceEntries"
export * from "./gamePlatformSupport"
export * from "./communityPresets"
export * from "./gameComments"
export * from "./savedGames"