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)

Columns of the reports table
ColumnTypeConstraintsDescription
iduuidprimary key
reporter_iduuidreferences users.id
content_typecontent_typenot null
content_iduuidnot null
subreddit_iduuidreferences subreddits.id
rule_iduuidreferences subreddit_rules.id
report_reason_iduuidreferences report_reasons.id
reasonreport_reasonnot null
detailsvarchar(1000)
statusreport_statusnot null
is_automatedbooleannot null
resolved_byuuidreferences users.id
created_attimestamptznot null
resolved_attimestamptz

Indexes (3)

  • (subreddit_id, status, created_at)
  • (content_type, content_id)
  • (status, created_at)

Relationships