If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Database Design for tracking Messages

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-12-10, 03:32
bharanidharanit bharanidharanit is offline
Registered User
 
Join Date: Nov 2008
Posts: 115
Database Design for tracking Messages

Hi,
In my website i am going to add messages features. so that they can send messages them.
How to design database for tracking inbox,sent items read and unread messages, How many tables i need to design?
I want these features to be added, when the users logins i want to show the unread messages to him?
And when he deletes the message must be deleted only for his view, but not fo the other user who sends the message.
Reply With Quote
  #2 (permalink)  
Old 02-12-10, 11:45
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,170
This question is very open ended. What have you come up with so far, perhaps we can comment on that?
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 02-12-10, 13:17
bharanidharanit bharanidharanit is offline
Registered User
 
Join Date: Nov 2008
Posts: 115
I dont know whether the table design is correct, as i am very beginner in this. Also this design causing me many errors.
Code:
CREATE TABLE message_index(
id INT NOT NULL AUTO_INCREMENT,
message_from INT NOT NULL,
message_to INT NOT NULL,
message_subject VARCHAR(100) NOT NULL,
message_body VARCHAR(1000) NOT NULL,
message_datetime DATETIME NOT NULL,
onfrom ENUM('0','1','2') NOT NULL,
onto ENUM('0','1','2') NOT NULL,
INDEX _id(id),
PRIMARY KEY(id))ENGINE=INNODB;
Code:
CREATE TABLE messages(
msgid INT NOT NULL,
message_from INT NOT NULL,
message_to INT NOT NULL,
msg_body VARCHAR(1000) NOT NULL,
msg_datetime DATETIME NOT NULL,
INDEX msg_id(msgid),
FOREIGN KEY(msgid) REFERENCES message_index(id) ON UPDATE CASCADE ON DELETE CASCADE)ENGINE = INNODB;
Reply With Quote
  #4 (permalink)  
Old 02-16-10, 21:58
bharanidharanit bharanidharanit is offline
Registered User
 
Join Date: Nov 2008
Posts: 115
How about this design?
messages.pdf
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On