feat: persistent lootbox states, update command now runs db migrations

This commit is contained in:
syntaxbullet
2025-12-18 17:02:21 +01:00
parent 83cd33e439
commit 7cf8d68d39
4 changed files with 79 additions and 38 deletions

View File

@@ -130,8 +130,17 @@ export const userTimers = pgTable('user_timers', {
}, (table) => [
primaryKey({ columns: [table.userId, table.type, table.key] })
]);
// 9. Lootdrops
export const lootdrops = pgTable('lootdrops', {
messageId: varchar('message_id', { length: 255 }).primaryKey(),
channelId: varchar('channel_id', { length: 255 }).notNull(),
rewardAmount: integer('reward_amount').notNull(),
currency: varchar('currency', { length: 50 }).notNull(),
claimedBy: bigint('claimed_by', { mode: 'bigint' }).references(() => users.id, { onDelete: 'set null' }),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
expiresAt: timestamp('expires_at', { withTimezone: true }),
});
// --- RELATIONS ---
export const classesRelations = relations(classes, ({ many }) => ({
users: many(users),