Setting up the db for a private messaging system
Posted 08 September 2006 - 07:20 AM
Posted 08 September 2006 - 07:27 AM
toid = id to person to send to
fromid = id who person he/she is sending to
messge = the message
date = timestamp (optional)
For toid and fromid, it's assuming you have another database where a user who have a unique ID. Otherwise, replace toid and fromid w/ whatever name of the people sending the message.
Message(mid*, toid, fromid, message, date)
Posted 08 September 2006 - 06:33 PM
I'm having some trouble thinking up an example using PMs, so I'll give you one along the lines of Ecommerce. If you had an online store, you'd most likely have a user table, where all your user's info is stored. But say you want to start storing information specific to each order, to keep an order history. It would be bad design to have an order history field in your user table, since each user can have more than 1 order. So you'd make a separate table. Same works with your PM situation. Just think about what data might be shared. A user can have more than 1 PM, so that means a table specifically for PMs is required. But what else might a user have more than 1 of? Or what data might be used by more than 1 user? Think of that when deciding what goes in your tables.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users