mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-02-04 10:54:44 -05:00
v2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
||||
import { integer, sqliteTable, text, index, unique } from 'drizzle-orm/sqlite-core';
|
||||
|
||||
import { sql } from 'drizzle-orm';
|
||||
|
||||
@@ -24,3 +24,17 @@ export const dailyVerses = sqliteTable('daily_verses', {
|
||||
});
|
||||
|
||||
export type DailyVerse = typeof dailyVerses.$inferSelect;
|
||||
|
||||
export const dailyCompletions = sqliteTable('daily_completions', {
|
||||
id: text('id').primaryKey(),
|
||||
anonymousId: text('anonymous_id').notNull(),
|
||||
date: text('date').notNull(),
|
||||
guessCount: integer('guess_count').notNull(),
|
||||
completedAt: integer('completed_at', { mode: 'timestamp' }).notNull(),
|
||||
}, (table) => ({
|
||||
uniqueCompletion: unique().on(table.anonymousId, table.date),
|
||||
dateIndex: index('date_idx').on(table.date),
|
||||
dateGuessIndex: index('date_guess_idx').on(table.date, table.guessCount),
|
||||
}));
|
||||
|
||||
export type DailyCompletion = typeof dailyCompletions.$inferSelect;
|
||||
|
||||
Reference in New Issue
Block a user