Repository navigation
feat!: reference course scopes by course key instead of a foreign key - #627
mariajgrimaldi wants to merge 2 commits into
Conversation
|
Thanks for the pull request, @mariajgrimaldi! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
b8d3e98 to
b3ce762
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
b3ce762 to
630340a
Compare
Django ran the copy step in a transaction, so the error raised on a conflict also rolled back the keys copied before it, while the docstring, the how-to and ADR 0035 say they stay. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Description
Following ADR 0035 (#625),
CourseScopereferences its course only through the course key inexternal_key, so the framework's schema no longer depends on the platform's course table.external_key, andcourse_overviewbecomes a read-only property that returns the course, orNonewhile it doesn't exist.post_deletereceiver on the course model deletes the course's scope and its role assignments, as the foreign key cascade did.0013_remove_coursescope_course_overviewcopies the key of older scopes intoexternal_keyand removes the column. When a key collides with another scope's key, it stops before removing the column and names a new how-to that resolves the conflict.This is a breaking change, since filtering or creating scopes with
course_overviewandCourseOverview.authz_scopesno longer work, and the equivalent isexternal_key=str(course.id). A code search across the openedx organization found no uses outside this repo (CourseScope,authz_scopes). Migrating back below0013adds the foreign key again, so it fails with error 3780 on the databases from #593.Related to #593.
Testing instructions
0012, create course scopes with and without keys, and run0013, including a key conflict../manage.py lms migrate. Every user keeps the same roles, andopenedx_authz_coursescopehas nocourse_overview_idcolumn.0013reports conflicting scopes, follow the how-to and run./manage.py lms migrateagain. It finishes, and the remaining scope has the role assignments of both.Merge checklist:
Check off if complete or not applicable: