I am developing a new site, and I have to do private messages for our users. I already did this on other projects, but the design there just does not seem right (I can not have more than two people participating in the message, for example). So what is the βrightβ approach to this? I would like to offer my users the same functionality as Facebook (again, I already did it, but it feels dirty :)) Thus, the system should support 2 or more users in messages and thread-like messages.
I thought, and one solution will consist of two tables:
pm_messages: id | pm_messages_id | user_id | title | content | date Time
pm_recipients: id | pm_messages_id | user_id | has_seen | cross out
I would save the actual content in the pm_messages table, and I would save the recipients (including the original sender) in the pm_recipients table.
Is this the right direction or am I completely managing this? My concern is that messages are not really deleted until all recipients have deleted the message, which leads to some uncomfortable deletion logic.
source share