Hi,
I'm developing a new site, and I have to make private messages for our users. I have already made this on other projects, but the design there just doesn't seem right (I can't have more than two people engaged in a message for instance). So what is the "right" approach to this? I'd like to offer my users the same functionality as Facebook (again, I have already done this but it feels dirty :)) So the system should support 2 or more users in a conversation and thread-like messages.
I was thinking and one solution would be to have two tables like so:
pm_messages: id | pm_messages_id |user_id | title | content | date_time
pm_recipients: id | pm_messages_id | user_id | has_seen | deleted
I would store the actual content in the "pm_messages" table, and I would store the recipients (including the original sender) in the "pm_recipients" table.
Is this the right direction or am I completely off with this? What bothers me here is that messages don't really get deleted until all of the recipients have deleted the message which leads to some awkward deleting logic.