Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 39x 39x 39x 39x 39x 39x 2x 2x 2x 2x | import { createId } from '@paralleldrive/cuid2'
import { integer, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core'
import { players } from './players'
/**
* Progression deferrals table - stores teacher decisions to defer skill progression.
*
* When the system recommends advancing to a new skill, the teacher can click
* "Not yet, ask again later" to defer the progression for a period.
*/
export const progressionDeferrals = sqliteTable(
'progression_deferrals',
{
/** Primary key */
id: text('id')
.primaryKey()
.$defaultFn(() => createId()),
/** Player this deferral applies to */
playerId: text('player_id')
.notNull()
.references(() => players.id, { onDelete: 'cascade' }),
/** The skill being deferred */
skillId: text('skill_id').notNull(),
/** When the deferral was created (Unix timestamp ms) */
deferredAt: integer('deferred_at').notNull(),
/** When the deferral expires (Unix timestamp ms) */
expiresAt: integer('expires_at').notNull(),
},
(table) => ({
/** Only one active deferral per player per skill */
playerSkillUnique: uniqueIndex('progression_deferrals_player_skill_idx').on(
table.playerId,
table.skillId
),
})
)
export type ProgressionDeferral = typeof progressionDeferrals.$inferSelect
export type NewProgressionDeferral = typeof progressionDeferrals.$inferInsert
|