laravel-nestedset
laravel-nestedset copied to clipboard
The tree got broken very frequently and deleting node triggers deleting of random records
I went through the code, where I noticed that upon deleting the node the children are also got deleted, and the children are calculated based on _lft filed using between query.
When the tree is broken, the _lft field is creating a mess where the wrong records are fetched as children and are deleted.
update
`post`
set
`deleted_at` = '2022-06-15 13:55:22',
`post`.`updated_at` = '2022-06-15 13:55:22'
where
`post`.`_lft` between 4200
and 6000
and `post`.`deleted_at` is null
What would be a possible way to correctly tackle this.
See #226; maybe do a fixtree before executing the delete?