modmail_conversations table
The modmail_conversations table in the Reddit Clone Database Schema schema has 10 columns, keyed by id, with 3 foreign keys to subreddits and users. 1 column in modmail_messages references it.
Modmail is a conversation addressed to a TEAM, which is why it has its own table with an assignee and a state rather than being a message with many recipients. is_internal marks a mod-only discussion thread the participant never sees.
Columns (10)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| subreddit_id | uuid | not null, references subreddits.id | |
| participant_id | uuid | references users.id | |
| subject | varchar(200) | not null | |
| state | modmail_state | not null | |
| is_internal | boolean | not null | |
| assigned_to | uuid | references users.id | |
| message_count | integer | not null | |
| last_message_at | timestamptz | not null | |
| created_at | timestamptz | not null |
Indexes (3)
(subreddit_id, state, last_message_at)(participant_id)(assigned_to, state)
Relationships
modmail_conversations.subreddit_idreferencessubreddits.idmodmail_conversations.participant_idreferencesusers.idmodmail_conversations.assigned_toreferencesusers.idmodmail_messages.conversation_idreferencesmodmail_conversations