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)

Columns of the banned_domains table
ColumnTypeConstraintsDescription
iduuidprimary key
subreddit_iduuidreferences subreddits.id
domainvarchar(255)not null
reasonvarchar(500)
added_byuuidreferences users.id
added_attimestamptznot null

Indexes (2)

  • (subreddit_id, domain) unique
  • (domain)

Relationships