subreddits table

The subreddits table in the Reddit Clone Database Schema schema has 36 columns, keyed by id, with 2 foreign keys to crowd_control_settings and users. 40 columns in user_profiles, user_trophies, subreddit_subscriptions, subreddit_moderators and 35 more reference it.

name is the string after r/ and is unique site-wide, which is why it is the natural key humans quote while the uuid is what foreign keys use. is_profile_subreddit is the column that lets u/name reuse the entire post, comment and moderation stack instead of duplicating it. comment_score_hide_minutes is a real anti-pile-on tool: it hides scores for the first N minutes so early votes cannot anchor later ones.

Columns (36)

Columns of the subreddits table
ColumnTypeConstraintsDescription
iduuidprimary key, references crowd_control_settings.subreddit_id
namevarchar(21)unique, not null
titlevarchar(100)not null
public_descriptionvarchar(500)
description_mdtext
sidebar_mdtext
submit_text_mdtext
welcome_message_mdtext
typesubreddit_typenot null
submission_typesubmission_typenot null
wiki_permissionwiki_permissionnot null
is_profile_subredditbooleannot null
is_nsfwbooleannot null
is_quarantinedbooleannot null
quarantine_reasonvarchar(500)
allow_pollsbooleannot null
allow_imagesbooleannot null
allow_videosbooleannot null
allow_galleriesbooleannot null
allow_crosspostsbooleannot null
spoilers_enabledbooleannot null
restrict_postingbooleannot null
restrict_commentingbooleannot null
comment_score_hide_minutessmallintnot null
minimum_account_age_dayssmallint
minimum_karmainteger
subscriber_countintegernot null
active_user_countintegernot null
icon_urlvarchar(500)
banner_urlvarchar(500)
header_urlvarchar(500)
primary_colorchar(7)
key_colorchar(7)
languagevarchar(12)not null
created_byuuidreferences users.id
created_attimestamptznot null

Indexes (4)

  • (subscriber_count)
  • (is_nsfw, subscriber_count)
  • (is_profile_subreddit, name)
  • (type, subscriber_count)

Relationships