Answer the question
In order to leave comments, you need to log in
Creating an sql table for a separate private chat. Does it make sense and why?
Hello. Very noob question, sorry. General chat app. For messages, it has its own table in the database. Now I want to make private messages between users.
Option 1. In the same one as everything but with additional addressing columns.
Option 2. Make a separate table for private messages.
Option 3. Generate a table of private messages for each user.
Which of these options is the worst and the best, and most importantly why?
Answer the question
In order to leave comments, you need to log in
Short answer: options 1 and 2 are fine, the third is very bad.
The first option will be optimal, because it will entail the least amount of code. Just add one field Addressee. This way you can easily add group chats (except the main one). you will not need to synchronize and unify two separate message models with each other, you can easily and without unnecessary cases quote, you will not have to write separate code for implementing private messages, it will be the same as when working with a general or group chat.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question