Question

I have a mysql table named messages. It's structure below

id | sender_id | receiver_id | message | date | is_receiver_read | conversation_id

1  | 99        | 456         | hello   | 2014 | 1                | 99x456

2  | 456       | 99          | hi)     | 2014 | 0                | 99x456

When a sender or receiver delete messages from conversation i don't want to show to him messages from this conversation. How can do it?

When I add columns which named 'is_sender_delete' and 'is_receiver_delete' there is a problem. For first message sender is 99 but for second message sender is 456. When I update my table after an user press 'delete converstaion button' which column should I update?

If this structure is wrong, what is the alternative solution?

No correct solution

OTHER TIPS

I think you need something like this...

CREATE TABLE subscriptions
(user_id INT NOT NULL
,conversation_id INT NOT NULL
,subscribed TINYINT NOT NULL DEFAULT 1
,PRIMARY KEY(user_id,conversation_id)
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top