How to correctly update the information in the table with nested sets?

Problem - lost the numbers in some entries in right and left fields. Information about the hierarchy is (parent_id field), and it is correct. How to convert right and left for the whole tree?
April 4th 20 at 00:45
2 answers
April 4th 20 at 00:47
Firstly solve the problem with the downed code. Some sort of crap has ruined your structure.
And secondly, restart the build.

PS how do you imagine editing errors? Let's say you have lost a parent. How to make a will?

The idea is to take the whole range and spread right to the left, but without seeing code and without knowing what the error is MATUSHKINO occupation.
The error occurred due to incorrect removal of a few nodes. Accordingly, the more so will not do.
There is a parent_id in the table which points to the parent, i.e., the hierarchy remained intact. Lost only ranges. - Mckenna commented on April 4th 20 at 00:50
@Mckenna, No code is still hard to say.
Is there a php library for working with nested sets?
Look this way and choose one of the solutions.
The idea is they provide data consistency. As I understand it was a direct removal from database, not through the interface?

As a workaround you can create stubs for these IDs and delete them from the interface. - aileen.Beck commented on April 4th 20 at 00:53
April 4th 20 at 00:49
1. List the integrity of the structure in the code.
2. Follow the validation errors and correct them consistently.

Find more questions by tags MySQLNested set