Added verse-submission infrastructure

This commit is contained in:
George Powell committed 2026-07-07 15:41:10 -04:00
1 parent 99552c57ad
commit be0d7ad297
17 files changed
+1293 -26

No files matched your search

+17
View File
@@ -48,3 +48,20 @@ export const dailyCompletions = sqliteTable('daily_completions', {
]);
export type DailyCompletion = typeof dailyCompletions.$inferSelect;
export const verseSubmissions = sqliteTable('verse_submissions', {
id: text('id').primaryKey(),
// Nullable so ON DELETE SET NULL can clear attribution when a user is deleted;
// the scheduled verse still plays out (canonical text lives on daily_verses).
userId: text('user_id').references(() => user.id, { onDelete: 'set null' }),
scheduledDate: text('scheduled_date').notNull().unique(),
selectedBookId: text('selected_book_id').notNull(),
selectedChapter: integer('selected_chapter').notNull(),
selectedVerse: integer('selected_verse').notNull(),
// Raw integer of server UTC milliseconds — drives the 7-day rolling cooldown.
submittedAt: integer('submitted_at').notNull(),
}, (table) => [
index('verse_submissions_user_id_idx').on(table.userId),
]);
export type VerseSubmission = typeof verseSubmissions.$inferSelect;