I would define
- the relationship of to-many
subplans (or children ) from the Plan object to itself, with the "Delete Rule" set to "Cascade", - one-to-one
superplan (or parent ) relation from the Plan object to itself, while the “Delete Rule” is set to “Nullify”, - and set them as inverse relationships with each other.
If you delete one Plan object, then automatically
- all subplanes are deleted due to the Cascade deletion rule and
- the plan is deleted from its parent due to the Nullify deletion rule.
source share