Repository navigation
Description
Rules held only in code, and columns nothing uses. None is urgent; do them together the next time the schema changes.
Rules:
users.emailis nullable with a non-unique index. Uniqueness rests onprofile::email_takenand anORDER BY id LIMIT 1inauth::CREDENTIALS_SQL. Add a unique index onlower(email).- Only
jobs.statehas aCHECK. Unchecked text:courses.state,courses.source,lesson_passes.*_via,users.two_factor,course_ai_run_files.side,api_tokens.kind.CourseState::parsemaps anything unknown toReady(src/courses.rs:499).CHECKs need a table rebuild, so add each when its table is rebuilt for another reason. course_id TEXT NOT NULL DEFAULT 'spanish'onquiz_history,game_scoresandgame_activity. Every insert supplies the column; drop the defaults.
Unused:
users.delete_atandidx_users_delete_at: never read or written.jobs.priority: never written, read only in anORDER BY(src/jobs.rs:164).- Written and never read:
lesson_passes.updated_at,journey_progress.updated_at,lesson_notes.updated_at,courses.created_at,course_shares.created_at. Decide per column: show it somewhere or drop it. (users.age_confirmedandsignup_invites.used_byare records and should stay.) users.email_verified_at: in a release only proxy sign-in sets it, and it shows as a ✓ on the profile. Probably drop it with the badge.
Orphans: delete_course keeps every per-course progress row "so a course re-added under its id finds them", but ids carry a random suffix (src/courses.rs:1006), so nothing ever finds them. Delete them in delete_course, inside a transaction, or list them in docs/data-inventory.md as kept.
Silent defaults on our own JSON columns: serde_json::from_str(s).unwrap_or_default() for review exclusions and edits (src/review.rs:67,142), check notes (src/ai/check.rs:54) and the translate plan (src/translate.rs:45). After a format change, "left out of the review" becomes "nothing left out" without a word. Log a warning at those four sites.
From the code review of 24 November 2026. Line numbers are as of 0.5.0 (2547b36).
Activity