Reputation: 19966
I'm in process of re designing a prototype and I'm hit a roadblock. Using a relationship makes life easy - but should I use it in this case.
I'm leaning towards not using it. This is a simplified version of my problem.
VISIT (many) <<--> (one) CLIENT
Each visit can be with only 1 client, and a client can have many visits.
(another example would be a client <->> invoice relationship)
Say my client changes address, when I'm looking at my Visit entities and the associated client - I'll always have the up to date details.
If I didnt have a relationship, and just a variable like clientName within the visit object - well you would have to manually go through and update each object.
Problem:
If I use a relationship between the objects
The issue is deletion - if I want to keep my Visit objects with a valid client object then I cannot allow client deletion. But surely you should be able to delete a client - so I will include that feature in the app. But if I do delete the client - there goes my valid client info that was associated with the Visit.
So even though making a relationship seems to be the best thing to do initially - you should really have the associated info within the visit object... and thus scape the relationship ?
Thanks for any advice.
Upvotes: 2
Views: 49
Reputation: 40028
You might go with a boolean flag archived
. So instead of deleting the Client
entity you would set archived
to YES
.
Upvotes: 3