So, I'm defining a structure that is going to be my focus for quite some time, so I want it to be supportable.
I have various entities with explicit relationships.
I'm defining the relations separate from the objects so that I can re-use the base components.
This would look like
Person --- PersonAddressRelationship --- Address
Person --- PersonPhoneRelationship --- Phone
PersonAddressRelationship looks like:
PAR_ID
PersonID
AddressID
RelationshipType
My question is:
Do I further normalize this structure so that all the relationships are in the same table, which some keys that define what entities they are for?
Person --- Relationship --- Address
Person --- Relationship --- Phone
Relationship looks like:
RelationshipID
SourceTableID
SourceTableKeyID
TargetTableID
TargetTableKeyID
RelationshipType
Right now I'm leaning towards explicit tables, because overly normalized structures are sometimes painful to code against.
TIA,
Lodlaiden
You've got questions and source code. We want both!
I have various entities with explicit relationships.
I'm defining the relations separate from the objects so that I can re-use the base components.
This would look like
Person --- PersonAddressRelationship --- Address
Person --- PersonPhoneRelationship --- Phone
PersonAddressRelationship looks like:
PAR_ID
PersonID
AddressID
RelationshipType
My question is:
Do I further normalize this structure so that all the relationships are in the same table, which some keys that define what entities they are for?
Person --- Relationship --- Address
Person --- Relationship --- Phone
Relationship looks like:
RelationshipID
SourceTableID
SourceTableKeyID
TargetTableID
TargetTableKeyID
RelationshipType
Right now I'm leaning towards explicit tables, because overly normalized structures are sometimes painful to code against.
TIA,
Lodlaiden
You've got questions and source code. We want both!