-- curriculum_assignments — which curriculum path a cohort or an individual student is on. -- Only one curriculum exists today (scenarios/rootnode-path.json, "RootNode Learning Path") — -- this table exists so assigning it is a real, visible instructor action (and so a second path -- can be added later without a schema change), not because multiple paths exist yet. CREATE TABLE IF NOT EXISTS curriculum_assignments ( assignment_id BIGSERIAL PRIMARY KEY, cohort_id TEXT REFERENCES cohorts(cohort_id), student_id TEXT REFERENCES students(student_id), curriculum_path TEXT NOT NULL DEFAULT 'rootnode-path', assigned_at TIMESTAMPTZ NOT NULL DEFAULT now(), CONSTRAINT curriculum_assignment_target CHECK (cohort_id IS NOT NULL OR student_id IS NOT NULL) ); CREATE INDEX IF NOT EXISTS idx_curriculum_cohort ON curriculum_assignments(cohort_id); CREATE INDEX IF NOT EXISTS idx_curriculum_student ON curriculum_assignments(student_id);