D
D
Dmitry Arushanov2015-10-13 20:41:53
Algorithms
Dmitry Arushanov, 2015-10-13 20:41:53

What is the principle of storing messages in correspondence?

Good day to all.
Someone will tell you what is the principle of storing messages in correspondence. For example, as in contact.
The following is interesting:
Two users communicated for a long time - they communicated. And then one of them deleted all correspondence. But at the same time, this correspondence remained in full for the second user. And for the one who deleted it, it continues from the place from which he deleted it.
How is it marked?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2015-10-14
@xmoonlight

message and recipients.
When a message is sent by one addressee to another or several, links are created.
Example for 3 interlocutors, one of them sent:
Messages:
messageID->messageTEXT
Correspondence (message recipients):
messageID -> addressee-sender
messageID -> addressee-recipient1
messageID -> addressee-recipient2
If someone deletes the message (I ), then only links with recipients are deleted.
For example, if you deleted recipient1, then it will remain:
Messages:
messageID->messageTEXT
Correspondence (message recipients):
messageID -> sender-address messageID
-> recipient2

N
Nadz Goldman, 2015-10-13
@nadz

I would do this:
message_id int,
time datetime,
message_body varchar,
friend_id int,
flag_deleted bool,
flag_readed bool.
Well, that's me in general. Well, not a muscle, but so.
Well, when we process the output from the table, we take everything with the flag_deleted flag omitted.
Type like this:
select * from messages_table where flag_deleted != 1;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question