Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database schema of messaging application

In my messaging application, The features I want to provide are:

  • Sending a message to multiple people
  • Receiving message sent to a user
  • Showing message in groups divided by the users, Like in facebook message
  • But when a user will send a message to multiple people, It will not be a group message but those messages will go in groups divided by users

My database schema is like this My database schema

This schema is able to provide all the functions above but getting the message out from this kind of schema in groups of users is very complex. Can anyone suggest me some better schema??

The unnamed table is of receivers mapping, forgot to write the name in jpg. :(

like image 839
Sourabh Avatar asked Sep 27 '11 13:09

Sourabh


1 Answers

What is wrong with one table?

message_id timestamp to from subject body attachment_pointer origin

...

I'll probably get thrashed for it but... hmm...good point

Messages
message_id
timestamp
subject
body
attachment

MessageReference
mr_id
message_id
to
from

edit: Also found these:

Messaging system database schema

thread messaging system database schema design

How should I setup my database schema for a messaging system complete with attachments?

Database schema for messaging to multiple users

like image 180
johnny Avatar answered Sep 18 '22 07:09

johnny