user_flairs table
The user_flairs table in the Reddit Clone Database Schema schema has 6 columns, with 4 foreign keys to subreddits, users and flairs.
Flair is per community: the same person is a different thing in r/rust and r/cooking. text_override exists because many subs let a member edit the label while keeping the template styling.
Columns (6)
| Column | Type | Constraints | Description |
|---|---|---|---|
| subreddit_id | uuid | not null, references subreddits.id | |
| user_id | uuid | not null, references users.id | |
| flair_id | uuid | references flairs.id | |
| text_override | varchar(64) | ||
| assigned_by | uuid | references users.id | |
| assigned_at | timestamptz | not null |
Indexes (1)
(user_id)
Relationships
user_flairs.subreddit_idreferencessubreddits.iduser_flairs.user_idreferencesusers.iduser_flairs.flair_idreferencesflairs.iduser_flairs.assigned_byreferencesusers.id