Allow new discipline deletion when it has no users and no collections#7812
Open
acwhite211 wants to merge 6 commits intomainfrom
Open
Allow new discipline deletion when it has no users and no collections#7812acwhite211 wants to merge 6 commits intomainfrom
acwhite211 wants to merge 6 commits intomainfrom
Conversation
Member
Author
|
Looking to see if the discipline deletion process can be made faster. |
Member
Author
|
Deleting all the schema config and tree records within the discipline was slowing down the discipline deletion request. One solution was to move the deletion process to the worker, similar to what we do for discipline creation. Another solution was using direct SQL queries, instead of using Django to go through and delete all the dependencies. I went ahead and implemented the direct SQL solution to avoid the complications of a delayed deletion through a worker process. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7649
A newly created discipline could not be deleted from the System Configuration Tool even when it had no user-created records. The delete blocker flow was treating discipline owned tree definition data as blockers, so the UI reported the discipline as undeletable even though the intended business rule is narrower.
This PR adds a special case for disciplines in the delete_blockers API. A discipline can be deleted when it has no associated collections and no associated users. The implementation adds discipline specific guard blockers for collections and users, updates discipline deletion to enforce that rule before delete, and detaches discipline owned tree definitions during the delete flow so preloaded tree data does not create false blockers.
Checklist
self-explanatory (or properly documented)
Testing instructions
Empty discipline deletion
Delete.Verify:
GET /delete_blockers/delete_blockers/discipline/<id>/returns an empty list.Discipline with collection
Verify:
Collectionas the reason.