Skip to content

Add helper methods for updating sequence when deleting/inserting Nodes #13

@chriscarrollsmith

Description

@chriscarrollsmith

We need to enforce that:

  • sequence is unique within the parent
  • sequence doesn't skip integers

If the user inserts a node with a sequence number that already exists, we likely want to increment the sequence numbers of all siblings that are greater than or equal to that number.

Similarly, we need to decrement if the user deletes a node.

And we likely need to handle the case where the user updates the sequence number. E.g., if a node's sequence number is decreased with an update command, then we need to increment the siblings that have sequence greater than or equal to the new value, but less than the original value.

All of the update logic should probably be wrapped in a single transaction to make sure everything stays in sync end-to-end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions