feat(server): tree, tags, review modes, settings and assets (ADR 0004)
All checks were successful
CI / check (push) Successful in 4m18s
CI / deploy (push) Has been skipped

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>
This commit is contained in:
Tizian 「ティツィアーン」 2026-09-30 23:27:08 +02:00
commit 29a2105a55
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -16,6 +16,11 @@ fields:
### How long answering took, from showing the card to rating it, in
### milliseconds.
durationMs: int
### 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'.
mode: String, default='review'
indexes:
# Deleting a space finds its rows through this index (see studyset.spy.yaml).
review_log_space_idx: