Uh oh!
There was an error while loading. Please reload this page.
fix(db): drop vestigial course_code NOT NULL on course_offerings (0028) - #277
Conversation
… (0028) 0020 renamed courses→course_offerings and dropped the abstract columns but missed course_code, which stayed NOT NULL. Existing rows have it populated, but every NEW offering insert (app resolve_offering/add_course AND seed_staging) omits it → 23502 not-null violation. The abstract course_code lives on `courses` now. Surfaced by seeding staging; would also break add_course against the real DB. 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 | fc7ae87 | Commit Preview URL Branch Preview URL | Jun 24 2026, 10:09 PM |
Real-DB bug surfaced by seeding staging.
0020renamedcourses → course_offeringsand dropped the abstract columns (course_name/department/credits/description/semester/school) but missedcourse_code, which stayed behindNOT NULL(from the 0001 baseline).The 8192 migrated rows have it populated so it went unnoticed — but every new offering insert fails with Postgres
23502, because neitherseed_staging.pynor the app suppliescourse_code. This means the app'sresolve_offering(create=True)/add_coursewould hit the same error against the real DB (mocked tests couldn't catch it).0028drops the redundant column (abstractcourse_codelives oncourses, reached viacourse_offerings.course_id).DROP COLUMN IF EXISTS→ idempotent. Existing rows lose only a redundant column.Apply to staging:
dotenv -f .env.staging run -- python -m db.migrate, then re-run the seed.