I'm trying to design the database schema with the ability to both private chat and group chat. Here's what I've got so far:
So - the theory is that even if the user is just in a one on one private chat, they are still assigned a 'roomID', and each message they send is to that room
.
To find out all the rooms they are involved in, I can SELECT a list from the table participants
to find out.
This is okay, However it feels to me that the room
table is slightly redundant, in that I don't really need a room name, and I could leave it out and simply use the participants
table and SELECT DISTINCT roomID FROM particpants
to find out the individual rooms.
Can anyone explain to me a better structure or why I should keep the room table at all?