Uh oh!
There was an error while loading. Please reload this page.
feat(db): schema-foundation migrations 0019-0026 (target schema) - #264
Conversation
Authors the complete modular target schema as one coherent set: terms+schools+updated_at trigger (0019), academics catalog/offering/enrollment split with data-preserving catalog transform (0020), gradebook re-keyed to enrollment (0021), analytics re-keyed to offering (0022), graph integrity + mastery events (0023), identity profile split (0024), study/sessions integrity (0025), ops cleanup (0026). Text PKs, FKs+ON DELETE, real types, CHECK enums read off code, encryption columns kept TEXT. Validated 0001->0026 end-to-end against Postgres 15 incl. the catalog transform. Source of truth for the per-domain code PRs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with |
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs | frontend-staging | c26ecf4 | Commit Preview URL Branch Preview URL | Jun 24 2026, 06:40 AM |
…nts ids The renamed baseline tables inherited a TEXT PRIMARY KEY with no default, unlike every other table in the redesign. Add gen_random_uuid()::text so the app does not have to supply ids on insert for these two tables.
… redesign Folds the in-flight DB changes from origin/Gradebook and origin/chore/staging-ops-scripts into the redesign so nothing is lost and the schema stays the single source of truth: drop-lowest -> gradebook_categories.drop_lowest; bell-curve policy -> enrollments.curve_*; per-assignment curve stats + gradescope_assignment_id -> assignments; gradescope_credentials + gradescope_course_links (link re-targeted to enrollment_id) -> 0027; newsletter_emails.approved_at -> 0026. Those branches' migration files are now superseded; their CODE rewire is tracked in filed issues. Validated 0001->0027 against Postgres 15. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
What this is
The schema source of truth for the modular redesign — migrations
0019–0026authored as one coherent set (per the schema-first decision). Targets the epic branch. Draft until it gets a staging apply + review.Spec:
docs/superpowers/specs/2026-06-23-db-modular-redesign-design.md· Plan:docs/superpowers/plans/2026-06-23-db-modular-redesign-epic.mdMigrations
0019_conventions_terms_schoolsset_updated_at()trigger fn;terms(seeded, date-derived "current");schools. Additive.0020_academics_splitcourses→ abstractcourses+course_offerings(per-term, FK toterms);user_courses→enrollments(offering_id).0021_gradebookcourse_categories→gradebook_categories,assignmentsre-keyed toenrollment_id;due_date date; type/source CHECK enums.0022_analyticscourse_concept_stats/course_summary→offering_*keyed onoffering_id; free-textsemesterretired.0023_graph_integrityUNIQUEdedup (retiresdedup_nodes.py), indexes,node_mastery_events(atomic mastery).0024_identity_splituser_profiles(1:1); profile columns removed fromusersanduser_settings;oauth_tokens.expires_at→ timestamptz.0025_study_integrityenrollments.syllabus_doc_idFK.0026_opsfeedback/issue_reportsuser FKs; integer-seq PKs → text.Conventions applied
Text PKs (decision: uuid deferred — would force a big-bang) · FKs everywhere with explicit
ON DELETE·created_at/updated_at+ trigger · real types (date/timestamptz) except 🔒 encrypted columns (kept TEXT) · CHECK enums read off the code (e.g.mastery_tierincludessubject_root;assignment.sourceismanual/syllabus, notgoogle).Validation
Applied the full
0001→0026chain against a throwaway Postgres 15 with a synthetic catalog (incl. two sections of one course in one term). All assertions passed: abstract-course dedup correct, every offering mapped to course+term, legacy tables dropped, profile-column duplication removed, exactly one "current" term. Not yet applied to staging — that's the pre-merge step.Notes / decisions baked in
SELECT DISTINCT semester FROM courses;and add any missingtermsrows (0019).courses.schoolis dropped (schools table supersedes it) — confirm no prod catalog relies on it, or populateschoolsfirst.messages.roleleft unconstrained (exact value set not confirmed in code).Next
After this merges to the epic: the per-domain code PRs (
db/academics-codefirst) adapt routes/services against this schema.🤖 Generated with Claude Code