Answer the question
In order to leave comments, you need to log in
How to create a table structure in a chat database?
Hello everyone, I need help creating a table structure for a chat, I need a chat like in VK.
1) There can be more than two participants
2) You can edit only your own messages (while the source of the old one was saved)
3) You can delete your message from all interlocutors, someone else's only from yourself (while the source of the message is saved)
4) You can send files
5) You can reply to messages (as in VK, you select a message, press reply, after which you write a message and when this message is delivered, the forwarded message is a link and highlights the original message in the dialog) (you can send as many messages as you like at a time)
Answer the question
In order to leave comments, you need to log in
1 Start by highlighting entities:
user
message
conversation
etc.
2 Draw a logical database diagram: entities and relationships between them (one-to-many, many-to-many, many-to-one). For example, one user can have many conversations.
3. Add attributes from the entity. For example, for a message, this is the date the message was sent, the date it was read, the sign of deletion/editing, etc.
4. Define keys and constraints.
4. Create a physical database. Many-to-many relationships are designed by a bridge table. Add the desired indexes, constraints, storage options for table data, partitioning, clustering, and so on.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question