mod_actions table
The mod_actions table in the Reddit Clone Database Schema schema has 12 columns, keyed by id, with 5 foreign keys to subreddits, users, reports and automod_rules.
The public moderation log, append-only. is_automated with a null moderator_id and an automod_rule_id is how a machine action is recorded, so a community can see exactly how much of its moderation is automated and which rule did it. Every removal, lock, sticky, ban and flair change lands here, which means moderator activity is itself reviewable.
Columns (12)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| subreddit_id | uuid | references subreddits.id | |
| moderator_id | uuid | references users.id | |
| action | mod_action_type | not null | |
| target_user_id | uuid | references users.id | |
| content_type | content_type | ||
| content_id | uuid | ||
| report_id | uuid | references reports.id | |
| automod_rule_id | uuid | references automod_rules.id | |
| is_automated | boolean | not null | |
| details | varchar(1000) | ||
| created_at | timestamptz | not null |
Indexes (4)
(subreddit_id, created_at)(moderator_id, created_at)(target_user_id, created_at)(content_type, content_id)
Relationships
mod_actions.subreddit_idreferencessubreddits.idmod_actions.moderator_idreferencesusers.idmod_actions.target_user_idreferencesusers.idmod_actions.report_idreferencesreports.idmod_actions.automod_rule_idreferencesautomod_rules.id