subreddit_rules table
The subreddit_rules table in the Reddit Clone Database Schema schema has 8 columns, keyed by id, with 1 foreign key to subreddits. 2 columns in subreddit_bans and reports reference it.
Rules are rows so a report can cite one by id. reports.rule_id pointing here is what makes a subreddit report queue different from a site-wide one.
Columns (8)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| subreddit_id | uuid | not null, references subreddits.id | |
| position | smallint | not null | |
| short_name | varchar(100) | not null | |
| description_md | varchar(1000) | ||
| violation_reason | varchar(100) | ||
| applies_to | rule_scope | not null | |
| created_at | timestamptz | not null |
Indexes (1)
(subreddit_id, position)
Relationships
subreddit_rules.subreddit_idreferencessubreddits.idsubreddit_bans.rule_idreferencessubreddit_rulesreports.rule_idreferencessubreddit_rules