Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008
    Posts
    117

    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.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    This question is very open ended. What have you come up with so far, perhaps we can comment on that?

  3. #3
    Join Date
    Nov 2008
    Posts
    117
    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;

  4. #4
    Join Date
    Nov 2008
    Posts
    117
    How about this design?
    messages.pdf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •