I have a setup where we have categories,
Each category has a title and a parent_id.
When a category is created/edited we check to ensure that no category that has the same parent_id has the same name.
That is easy.
But now I am working on deleting the categories.
The categories can have unlimited levels. so, if we delete a category it’s child categories get moved up to the categories parent. which is working fine, but I don’t know what to do in that instance when a collision occurs.
Should I do a precheck on the delete page and disable the delete button and have something like:
This category cannot be deleted as it will create a collision between the parent_of_current->something category and then current->something category please either delete or rename one of these categories.
or should I have a warning:
This action will create a collision between the parent_of_current->something category and then current->something category continuing will also delete the current->something category!
or is there something else I could do?
To be honest I like the second option, but I think that is liable to run into the same issue further down the chain if it creates another collision.
I would rename the offending category to show it needs attention. ie moving Sales, to where Sales already exists, it becomes Sales-1 or Sales-2, so the user would then need to rename it, and prevents loss of data. (like copying and pasting a file into the same directory) This way you can tell which was the original.