diff --git a/lib/db/schema/community-suggestions.ts b/lib/db/schema/community-suggestions.ts index 7a969b0..5745741 100644 --- a/lib/db/schema/community-suggestions.ts +++ b/lib/db/schema/community-suggestions.ts @@ -1,4 +1,5 @@ import { + index, pgEnum, pgTable, text, @@ -48,5 +49,6 @@ export const communitySuggestions = pgTable( table.fieldName, table.userId, ), + index("suggestions_status_idx").on(table.status), ], ) \ No newline at end of file diff --git a/lib/db/schema/gameVersions.ts b/lib/db/schema/gameVersions.ts index 5db9a05..fdabddb 100644 --- a/lib/db/schema/gameVersions.ts +++ b/lib/db/schema/gameVersions.ts @@ -1,5 +1,6 @@ import { boolean, + index, pgTable, text, timestamp, @@ -21,5 +22,8 @@ export const gameVersions = pgTable( isLatest: boolean("is_latest").default(false).notNull(), createdAt: timestamp("created_at").defaultNow().notNull(), }, - (table) => [unique("game_build_unique").on(table.gameId, table.buildId)] + (table) => [ + unique("game_build_unique").on(table.gameId, table.buildId), + index("perf_game_lookup_idx").on(table.gameId), + ] ) diff --git a/lib/db/schema/games.ts b/lib/db/schema/games.ts index 85d1597..52a179a 100644 --- a/lib/db/schema/games.ts +++ b/lib/db/schema/games.ts @@ -97,5 +97,8 @@ export const games = pgTable( createdAt: timestamp("created_at").defaultNow().notNull(), updatedAt: timestamp("updated_at").defaultNow().notNull(), }, - (table) => [index("games_source_idx").on(table.source)], + (table) => [ + index("games_source_idx").on(table.source), + index("games_sync_status_idx").on(table.syncStatus, table.steamAppId), + ], ) diff --git a/lib/db/schema/performanceEntries.ts b/lib/db/schema/performanceEntries.ts index 9d91500..55d3e0a 100644 --- a/lib/db/schema/performanceEntries.ts +++ b/lib/db/schema/performanceEntries.ts @@ -112,5 +112,7 @@ export const performanceEntries = pgTable( index("perf_hardware_upscaler_idx").on(table.hardwareSlug, table.upscalerType), index("perf_version_idx").on(table.versionId), index("perf_user_idx").on(table.userId), + index("perf_removed_created_idx").on(table.isRemoved, table.createdAt.desc()), + index("perf_upvotes_idx").on(table.upvotes.desc()), ], ) diff --git a/lib/db/schema/reports.ts b/lib/db/schema/reports.ts index 454d2fb..b08304a 100644 --- a/lib/db/schema/reports.ts +++ b/lib/db/schema/reports.ts @@ -1,4 +1,5 @@ import { + index, text, pgEnum, pgTable, @@ -37,4 +38,5 @@ export const reports = pgTable("reports", { createdAt: timestamp("created_at").defaultNow().notNull(), }, (table) => [ uniqueIndex("reports_entry_reporter_unique").on(table.entryId, table.reporterId), + index("reports_status_idx").on(table.status), ]) \ No newline at end of file