I
I
IceJOKER2015-08-02 17:41:56
MySQL
IceJOKER, 2015-08-02 17:41:56

How to correctly compose database structures for chat?

Hello, I just can’t think of a good structure for a chat, taking into account the conditions:

  1. The user can communicate face-to-face with another user.
  2. Can communicate with a group of users.
  3. Can chat in the chat room.

There are no problems with the first two conditions, doubts arise with the third condition, how to properly store and link data.
For example, there are tables:
users
id, login
rooms
id, name
Now my head doesn’t cook further - how to correctly create a message table (taking into account the conditions above) and a table of active dialogs (or is it better to build on the message table?)
The problem is that rooms are available to ALL users, they can enter, leave, and these rooms are always available, and communication between the user(s) takes place privately, these conversations are not visible to extra persons (this is the main difference between groups and rooms).
I would be very grateful for a detailed answer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2015-08-02
@xmoonlight

p.1,2,3 - this is all the object "room" for two, several, thematic .... what is there to think about?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question