-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MINT-3241] Delete categories #1565
base: feature/MINT-3175_mto
Are you sure you want to change the base?
[MINT-3241] Delete categories #1565
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration name needs to be updated, I think the next available one at the moment is 200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OddTomBrooks , can you update this please? DB migrate is failing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks Tom, this is looking good. I left a couple of questions and suggestions. Please let me know if you have any specific questions you want feedback on. Otherwise, I'll plan on doing a full review when you promote the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @OddTomBrooks , this is looking good. The app won't run currently because of the migration numbering. I provided some feedback, I will functionally test this when you have a chance to implement it
END IF; | ||
|
||
-- Recursively gather all descendant categories, including OLD.id | ||
WITH RECURSIVE cat_tree AS ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I'd suggest we don't use recursion. We only plan on allowing at most one level of depth, and recursion adds a greater overhead to the query. (from some past experiences and performance hits, if I can avoid recursion, I do)
SELECT array_agg(id) INTO cat_ids
FROM mto_category
WHERE parent_id = OLD.id OR id = OLD.id;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has not been a simple insertion, I'll revisit it early tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like the unit tests for the delete are failing now. Could you take a look please and re-request review when it's corrected?
MINT-3241
Description
Added server endpoint to delete MTO categories, rebinding references to the parent category reference (or NULL) and recursively deleting subcategories
How to test this change
PR Author Checklist
PR Reviewer Guidelines