banned_domains table
The banned_domains table in the Reddit Clone Database Schema schema has 6 columns, keyed by id, with 2 foreign keys to subreddits and users.
subreddit_id null is a site-wide domain ban. posts.domain is denormalised precisely so this check is an index lookup rather than a URL parse on every submission.
Columns (6)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| subreddit_id | uuid | references subreddits.id | |
| domain | varchar(255) | not null | |
| reason | varchar(500) | ||
| added_by | uuid | references users.id | |
| added_at | timestamptz | not null |
Indexes (2)
(subreddit_id, domain)unique(domain)
Relationships
banned_domains.subreddit_idreferencessubreddits.idbanned_domains.added_byreferencesusers.id