flairs table

The flairs table in the Reddit Clone Database Schema schema has 11 columns, keyed by id, with 1 foreign key to subreddits. 3 columns in user_flairs, posts and drafts reference it.

Flair is a row scoped to one subreddit, not free text on the post. That is what lets a community offer a fixed set, mark some mod-only, and rename one everywhere at once.

Columns (11)

Columns of the flairs table
ColumnTypeConstraintsDescription
iduuidprimary key
subreddit_iduuidnot null, references subreddits.id
typeflair_typenot null
textvarchar(64)not null
background_colorchar(7)
text_colorvarchar(10)
allowable_contentflair_contentnot null
max_emojissmallintnot null
is_mod_onlybooleannot null
is_editablebooleannot null
positionsmallintnot null

Indexes (1)

  • (subreddit_id, type, position)

Relationships