Jump to content

Personal message system db structure issue


Xtremer360

Recommended Posts

Putting together a personal message system and trying to figure out what I'm missing. I think what's confusing me is the possibility of forwards, bcc, and just responding and what not. I'm trying to cover everything on it.

 

Full texts Field Type Null Key Default Extra

id mediumint(11) NO PRI NULL auto_increment

subject varchar(255) NO NULL

senderID mediumint(5) NO NULL

recipientID mediumint(5) NO NULL

message text NO NULL

dateSent datetime NO NULL

dateRead datetime NO NULL

messageRead tinyint(1) NO NULL

messageReplied tinyint(1) NO NULL

messageForwarded tinyint(1) NO NULL

recipientDeleted tinyint(1) NO NULL

senderDeleted tinyint(1) NO NULL

Link to comment
Share on other sites

Your question is pretty similar to this one which has a good answer here, so I won't bother repeating what he said.

 

However I have some ideas for your other problems. For forwarding, you could simply create a new message that quoted the previous one, and add "FW:" to the subject or something. You don't need to have a special flag this way, and it keeps everything simple.

 

As far as bcc you could just create multiple messages with different recipient ID's.

Link to comment
Share on other sites

Or alternatively for your BCC feature you can create another table which houses a "PersonID" and a "MessageID". This is aiming more towards a normalised database unlike scootstah's suggestion of reinserting the message with a new ID.

 

It depends how well you want your database to be structured and how picky you want to be about normalisation.

Link to comment
Share on other sites

With version 1 of my script I really want to handle as much as doing things right the first time as possible and minimizing possible errors/issues down the road. With the db table structure I have above I'm trying to figure out what data should be split.

Link to comment
Share on other sites

What I'm trying to figure out is there anything out that I should include or even think about if a message can be forwarded or not.

 

Here's my updated structure:

 

usersPersonalMessages

 

Full texts Field Type Null Key Default Extra

id mediumint(11) NO PRI NULL auto_increment

subject varchar(255) NO NULL

senderID mediumint(5) NO NULL

message text NO NULL

dateSent datetime NO NULL

senderDeleted tinyint(1) NO NULL

 

 

usersPersonalMessagesRecipients

 

Full texts Field Type Null Key Default Extra

usersPersonalMessagesID mediumint(11) NO NULL

userID mediumint(5) NO NULL

bcc tinyint(3) NO NULL

messageRead tinyint(1) NO NULL

dateRead datetime NO NULL

recipientDeleted tinyint(1) NO NULL

 

 

Link to comment
Share on other sites

When you say "can be forwarded" do you mean in some situations it isn't possible to forward a message? Additionally, you could replace the "bcc" field with a "type" field and create a third tale with the different type ID's.

 

E.g. 1. Message, 2. CC, 3. BCC, 4. Fwd

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.