KenBrace Posted February 20, 2015 Posted February 20, 2015 I'm having a hard time figuring out the logic for creating a private messaging system that allows for more than 2 participants. What kind of database setup could I use to do this? I don't want to have a table with field for "user1", "user2", "user3", etc. because it strikes me as terribly inefficient and just messed up. How can I store the users of a conversation? Maybe have a table for conversations, messages, and participants? Then all the users inside the participants table that are filed under the specific conversation ID are allowed to access? Would there be a way to do it with only two tables? What do you think is the most efficient way to accomplish this task? Quote
Administrators Nathan Posted February 20, 2015 Administrators Posted February 20, 2015 I would do something like this: convo id convo createDate convoOwnerID messages id convoID message createDate messageOwnerID convoParticipants id userID convoID hasRead KenBrace 1 Quote
KenBrace Posted February 22, 2015 Author Posted February 22, 2015 I would do something like this: convo id convo create_date convo_owner_id messages id convo_id message create_date message_owner_id convo_participants id user_id convo_id I think XenForo does something similar to this for their conversation system. Seems to work pretty good. Thanks for the suggestion! Quote
Administrators Nathan Posted February 23, 2015 Administrators Posted February 23, 2015 Ah never used or seen the database on Xenforo. Quote
Sohani30 Posted March 25, 2019 Posted March 25, 2019 On 2/20/2015 at 9:31 PM, Nathan said: I would do something like this: convo id convo createDate convoOwnerID messages id convoID message createDate messageOwnerID convoParticipants id userID convoID hasRead Thanks for your valuable answer. It would be helpful to me. Nathan 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.