Skip to content

Implement unlinking all child elements in bulk in raw SQL

Just like Element.remove_child, except instead of removing a single child from a parent element, it removes every child at once. This should make fixing #795 easier, as just one call to element.remove_children() should be enough to deal with the issue.

This should be easier than #1529 because we operate on one parent element, which has the same parent paths. This is quite similar to remove_child:

  • Retrieve a few values:
    • whether every child has another parent element
    • whether no child at all has another parent element
    • whether there are multiple parent paths on this element
    • the first parent path of this element
  • If there is any child without another parent element, update the children's paths to strip off the first parent path of the element
  • If there is any child with another parent element, or if there are multiple parent paths, delete the paths to this element