I'm building a small messaging system like you have in facebook. Only thing is that I want to know whats the best way to get on about it. The database design to be precise in this case.
Like all users would have an inbox and sent items folder. Logically something in one persons sent folder would actually be in someone elses inbox. However I don't think using one table to hold the messages would work as lets say someone deletes a message form his sent box it would be gone since both reciever and sender would be referring to the same table. How do I implement this...
Sometimes a schema is better than a long explanation :
With this design, if someone deletes a message, it only deletes a row in the "users_has_messages" table, and not the message itself.
Of course, I just threw in some fields for the example, you will need much more for your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With