I'm not sure if this can be called a polymorphic association - what is needed is to for each Message
to have a Sender Contact
and a Recipient Contact
.
Both Sender Contact
and Recipient Contact
could be one of 2+ types. Currently SMS and Email are supported but more may come.
I have this urge to eliminate a possible duplication that would appear in case of having two different tables - sender_contacts
and recipient_contacts
. Also type
column is a kinda of a DB-modeling smell.
But I'm not a DB modelling expert and rather looking for an advise from an experts how to properly model those relationships.
Any input is appreciated.
Thanks.