reports table
The reports table in the Reddit Clone Database Schema schema has 14 columns, keyed by id, with 5 foreign keys to users, subreddits, subreddit_rules and report_reasons. 1 column in mod_actions references it.
rule_id set means the report cites a subreddit rule and lands in that communitys queue; null with a site reason means it escalates to admins. That one nullable column is the entire two-tier moderation model. (subreddit_id, status, created_at) IS the mod queue.
Columns (14)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| reporter_id | uuid | references users.id | |
| content_type | content_type | not null | |
| content_id | uuid | not null | |
| subreddit_id | uuid | references subreddits.id | |
| rule_id | uuid | references subreddit_rules.id | |
| report_reason_id | uuid | references report_reasons.id | |
| reason | report_reason | not null | |
| details | varchar(1000) | ||
| status | report_status | not null | |
| is_automated | boolean | not null | |
| resolved_by | uuid | references users.id | |
| created_at | timestamptz | not null | |
| resolved_at | timestamptz |
Indexes (3)
(subreddit_id, status, created_at)(content_type, content_id)(status, created_at)
Relationships
reports.reporter_idreferencesusers.idreports.subreddit_idreferencessubreddits.idreports.rule_idreferencessubreddit_rules.idreports.report_reason_idreferencesreport_reasons.idreports.resolved_byreferencesusers.idmod_actions.report_idreferencesreports