halkyon/halkyon_learn_server/lib/src/review/review_log.spy.yaml

32 lines
1.3 KiB
YAML
Raw Normal View History

### One rating of a card, never changed once written: a card's schedule isn't
### stored but derived on each device by replaying its reviews in time order,
### so reviews from different devices never conflict (decided 2026-09-30).
### Synced; the review goes with its card.
class: ReviewLog
table: review_log
database: sync
fields:
### The card reviewed.
card: Card?, relation(onDelete=Cascade, deferred)
### How well it was recalled, FSRS's ratings: 1 again, 2 hard, 3 good,
### 4 easy.
rating: int
### When, in UTC.
reviewedAt: DateTime
### How long answering took, from showing the card to rating it, in
### milliseconds.
durationMs: int
feat(server): tree, tags, review modes, settings and assets (ADR 0004) The schema of the features planned for the first release, as one migration: every migration of a synced table locks older app versions out of syncing (ADR 0002, rule 3), which costs nothing before that release. New card types need no migration; they are the next version of the revision payload. - studyset: `parent` (the tree; cycles and orphans show at the top level) and `position` among siblings (fractional index; existing studysets at 'a0'). - tag (its name in the payload) and card_tag, one row per assignment, so concurrent adds and removes merge. - review_log.mode: review, reverse (a schedule of its own) or cram (never moves a schedule); existing reviews are 'review'. - person_settings: study goals now, preferences later; random ids, since an id derived from the person could be claimed by someone else and break the owner's sync. - asset: a file's hash, type, size and name; the file goes into Serverpod's private cloud storage, served through an owner-checked endpoint (to come). Migration 20260930211154224-tree-tags-assets only adds: four tables with their space indexes and foreign keys, three columns with defaults. On devices SQLite rebuilds studyset and review_log to add foreign keys, which is safe only with foreign keys off, as Serverpod's runner does; a new test replays every client migration on a database with a row in each of our synced tables and checks that none is lost (with foreign keys on, it fails as it should). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-09-30 23:27:08 +02:00
### How the card was studied (ADR 0004): 'review' (front to back), 'reverse'
### (back to front, with a schedule of its own, as Anki's reverse cards have),
### or 'cram' (outside the schedule: counts for streaks and the activity
### heatmap, never moves a schedule). Reviews from before modes are 'review'.
### 'reset' is no rating but a fresh start: the card's schedules replay only
### what follows it, its rating means nothing.
feat(server): tree, tags, review modes, settings and assets (ADR 0004) The schema of the features planned for the first release, as one migration: every migration of a synced table locks older app versions out of syncing (ADR 0002, rule 3), which costs nothing before that release. New card types need no migration; they are the next version of the revision payload. - studyset: `parent` (the tree; cycles and orphans show at the top level) and `position` among siblings (fractional index; existing studysets at 'a0'). - tag (its name in the payload) and card_tag, one row per assignment, so concurrent adds and removes merge. - review_log.mode: review, reverse (a schedule of its own) or cram (never moves a schedule); existing reviews are 'review'. - person_settings: study goals now, preferences later; random ids, since an id derived from the person could be claimed by someone else and break the owner's sync. - asset: a file's hash, type, size and name; the file goes into Serverpod's private cloud storage, served through an owner-checked endpoint (to come). Migration 20260930211154224-tree-tags-assets only adds: four tables with their space indexes and foreign keys, three columns with defaults. On devices SQLite rebuilds studyset and review_log to add foreign keys, which is safe only with foreign keys off, as Serverpod's runner does; a new test replays every client migration on a database with a row in each of our synced tables and checks that none is lost (with foreign keys on, it fails as it should). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-09-30 23:27:08 +02:00
mode: String, default='review'
indexes:
# Deleting a space finds its rows through this index (see studyset.spy.yaml).
review_log_space_idx:
fields: spaceId
# A card's reviews, in time order.
review_log_card_idx:
fields: cardId, reviewedAt