user311509
user311509

Reputation: 2866

Database Design for Simple Private Messaging

The concept is simple:

  1. User click "Send PM" button on one of ads.

  2. Window pop up with "Title" box, "Message" box and send button.

  3. Recipient sees a message with following info: "Sender Name", "Date Received", "Title" and "Message".

  4. Recipient replies by filling: "Title" and "Message" and press reply.

  5. Repeat step 3.

No IP will be stored.

Can you please give me an idea how to make a concise/efficient relational design?

Upvotes: 3

Views: 701

Answers (1)

Pranay Rana
Pranay Rana

Reputation: 176896

Message table formate

Message

Id 
UserID
Message
Send_DateTime
Title
Message_Id ( FK )- self referance

self referance is to keep the track of the whole chat.

for the first message its NULL and than onwards id of relative meesage

Id     UserID    Message    Send_DateTime    Title    Message_Id ( FK )- self referance
1       1         test       datetime        tt       Null
2       2         test1      datetime        tt        1
3       1         test2      datetime        tt        2
...

go on 

Upvotes: 2

Related Questions