no isPrimary

This commit is contained in:
lila 2026-03-26 10:11:25 +01:00
parent c1b90b9643
commit a4a14828e8

View file

@ -134,6 +134,22 @@ Then `sudo sysctl -p` or restart Docker.
--- ---
## Data Model
### Translations: no isPrimary column
WordNet synsets often have multiple lemmas per language (e.g. "dog", "domestic dog", "Canis familiaris"). An earlier design included an isPrimary boolean to mark which translation to display in the quiz.
This was dropped because:
The schema cannot enforce a single primary per (term_id, language_code) with a boolean alone — multiple rows can be true simultaneously
Fixing that requires either a partial unique index or application-level logic, both adding complexity for no MVP benefit
The ambiguity can be resolved earlier and more cleanly
Decision: the Python extraction script picks one translation per language per synset at extraction time, taking the first lemma (WordNet orders lemmas by frequency). By the time data enters the database the choice is already made.
The translations table carries a UNIQUE (term_id, language_code) constraint, which enforces exactly one translation per language at the database level. No isPrimary column exists.
---
## Current State ## Current State
### Completed checkboxes (Phase 0) ### Completed checkboxes (Phase 0)