claude thinks it works
This commit is contained in:
@@ -45,25 +45,29 @@ export const mappool = pgTable('mappool', {
|
||||
});
|
||||
|
||||
// ── Mappool Slots ───────────────────────────────────────────────────────
|
||||
export const mappoolSlot = pgTable('mappool_slot', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
mappoolId: uuid('mappool_id')
|
||||
.notNull()
|
||||
.references(() => mappool.id, { onDelete: 'cascade' }),
|
||||
category: text('category').notNull(),
|
||||
orderInCategory: integer('order_in_category').notNull(),
|
||||
beatmapId: text('beatmap_id').notNull(),
|
||||
starRating: real('star_rating'),
|
||||
bpm: real('bpm'),
|
||||
totalLength: integer('total_length'),
|
||||
mods: text('mods').array().default([]).notNull(),
|
||||
// ── Cached beatmap metadata (stored at insert time → zero API calls on page load) ──
|
||||
title: text('title'),
|
||||
artist: text('artist'),
|
||||
version: text('version'),
|
||||
coverUrl: text('cover_url'),
|
||||
listCoverUrl: text('list_cover_url')
|
||||
});
|
||||
export const mappoolSlot = pgTable(
|
||||
'mappool_slot',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
mappoolId: uuid('mappool_id')
|
||||
.notNull()
|
||||
.references(() => mappool.id, { onDelete: 'cascade' }),
|
||||
category: text('category').notNull(),
|
||||
orderInCategory: integer('order_in_category').notNull(),
|
||||
beatmapId: text('beatmap_id').notNull(),
|
||||
starRating: real('star_rating'),
|
||||
bpm: real('bpm'),
|
||||
totalLength: integer('total_length'),
|
||||
mods: text('mods').array().default([]).notNull(),
|
||||
// ── Cached beatmap metadata (stored at insert time → zero API calls on page load) ──
|
||||
title: text('title'),
|
||||
artist: text('artist'),
|
||||
version: text('version'),
|
||||
coverUrl: text('cover_url'),
|
||||
listCoverUrl: text('list_cover_url')
|
||||
},
|
||||
(t) => [index('idx_mappool_slot_mappool').on(t.mappoolId)]
|
||||
);
|
||||
|
||||
// ── Matches ─────────────────────────────────────────────────────────────
|
||||
export const match = pgTable(
|
||||
@@ -82,7 +86,7 @@ export const match = pgTable(
|
||||
createdBy: text('created_by'),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull()
|
||||
},
|
||||
(t) => [index('idx_match_state').on(t.state)]
|
||||
(t) => [index('idx_match_state').on(t.state), index('idx_match_created_at').on(t.createdAt)]
|
||||
);
|
||||
|
||||
// ── Match Participants (a team in a match) ──────────────────────────────
|
||||
@@ -120,7 +124,8 @@ export const matchParticipantPlayer = pgTable(
|
||||
},
|
||||
(t) => [
|
||||
uniqueIndex('idx_mpp_participant_user').on(t.participantId, t.userId),
|
||||
index('idx_mpp_participant').on(t.participantId)
|
||||
index('idx_mpp_participant').on(t.participantId),
|
||||
index('idx_mpp_user').on(t.userId)
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user