How do you model the situation where the (foreign) table to which you relate is dependent on a value in the (primary) table?
This is the case:
- I have a table of Risks, and each Risk has a TreatmentType.
- If the TreatmentType is 'Accept', the Risk must be linked to an item in the Persons table.
- If the TreatmentType is 'Mitigate', the Risk must be linked to 1 or more items in the Controls table.
- If the TreatmentType is 'Transfer', the Risk must be linked to an item in the Departments table.
I could add different FK-fields for Person, Control and Department, and implement a rule to fill only one of these dependent on the value of TreatmentType, but it seems kind of sloppy.
It's been a while since I made a design for a database, what is good practice for this?