Answer the question
In order to leave comments, you need to log in
What database architecture to choose for a chat similar to VKontakte?
Hello!
Advise DB architecture for chat with history.
There is a table user , fields:
Answer the question
In order to leave comments, you need to log in
Well, make a table of dialogues and messages.
Messages (message_id, text, sent_date, status (read or not), dialog_id)
Dialogs (dialog_id, client_id1, client_id2)
True, a double bond is obtained. And the number of those not read is also displayed there, not a specific dialogue, but all. So just a request.
Well it is possible with only one table of the message. Where to store everything.
What prevents you from creating a flat table?
user_id | co_user_id | message | isaread
select * from messages where user_id = 3456754
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question