message_reads table
The message_reads table in the Social Media Database Schema schema has 4 columns, with 3 foreign keys to conversations, users and messages.
A high-water mark per participant, not a row per message. Unread count is a range query above this point.
Columns (4)
| Column | Type | Constraints | Description |
|---|---|---|---|
| conversation_id | uuid | not null, references conversations.id | |
| user_id | uuid | not null, references users.id | |
| last_read_message_id | uuid | references messages.id | |
| read_at | timestamptz | not null |
Relationships
message_reads.conversation_idreferencesconversations.idmessage_reads.user_idreferencesusers.idmessage_reads.last_read_message_idreferencesmessages.id