Database design for simple private messages

The concept is simple:

  • Click the "Send PM" button on one of the ads.

  • The window opens with the "Name", "Message" field and a submit button.

  • The recipient sees a message with the following information: "Sender's Name", "Date Received", "Name" and "Message".

  • Recipients' replies: “Title” and “Message” and press “Reply”.

  • Repeat step 3.

The IP address will not be saved.

Could you give me an idea on how to make a concise / effective relational design?

+3
source share
1 answer

Message Table Formatting

Message

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

- .

NULL

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 
+2

Source: https://habr.com/ru/post/1782766/


All Articles