How to deal with the design idea of the letter in a station

Source: Internet
Author: User
The design idea of the letter in the station
The design of the letter within the station, the requirements are similar to, for example:

A to the B station letter, will create a dialogue, click Open Dialogue, is a and B chat records

Difficulty :

1,a deleted one of the chats, but B's chat record is not changed

2,a Delete the conversation, but the conversation of B does not change

Find MySQL table design ideas, thank you!!!
------to solve the idea----------------------
UserID User ID
Conten Session Content
Del Delete flag: 1 Delete

------to solve the idea----------------------
Table structure.
ID, type, own_id, user_id, content, status, Addtime, lastmodify

Type:1 indicates that 2 of the issued
OWN_ID: represents your Own ID
USER_ID: Indicates the ID of each other
Content: Contents
Status:1 Display 0 Delete
Addtime: Release Time
Lastmodify: Last Modified time (if not available)


When id=1 people send messages to id=2. After sending, the table is recorded as follows

ID type own_id user_id content addtime lastmodify
1 1 1 2 content release time modified
2 2 2 1 content release time modified

The first record indicates that Id=1 sent a message to id=2
The second record indicates that id=2 received a message from id=1.
When id=1 delete information, the list of id=2 information will not be affected, and vice versa.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.