An Employee has an inverse relationship to it's Department and vice versa. The Employee entity has an Relationship called department, and it has a DENY delete rule. Employee shall be deleted. Now: Does DENY actually deny deletion of employee, because department is still referencing a Department? Or does it mean that a Department can't be deleted because an Employee is referencing it?
1 Answers
9
votes
Deletion rules are always looked at from the point of view of the object they are being set on so I think you have your description backwards. What you would want in that situation is:
Employee can be deleted any time and it's relationship to it's department should be nullified. This means you set the department relationship to nullify.
Department can only be deleted if it no longer has any employees. This calls for a deny rule which would prevent the deletion of a department if it contains any employee records at all.
Your description implied the reverse which would mean that the employee could not be deleted unless it's department was set to nil. While certainly possible, it seems unnecessary.