user_profiles table
The user_profiles table in the Reddit Clone Database Schema schema has 12 columns, keyed by user_id, with 1 foreign key to subreddits. 1 column in users references it.
Split one-to-one from users because a profile is read on every hover card and written far more often than credentials. profile_subreddit_id is the trick that makes u/name work: a profile IS a subreddit with is_profile_subreddit set, so profile posts reuse the whole posting and moderation stack rather than needing a parallel one.
Columns (12)
| Column | Type | Constraints | Description |
|---|---|---|---|
| user_id | uuid | primary key | |
| display_name | varchar(30) | ||
| about_md | varchar(1000) | ||
| avatar_url | varchar(500) | ||
| banner_url | varchar(500) | ||
| snoovatar_url | varchar(500) | ||
| profile_subreddit_id | uuid | references subreddits.id | |
| is_nsfw | boolean | not null | |
| accepts_direct_messages | boolean | not null | |
| accepts_chat_requests | boolean | not null | |
| show_karma | boolean | not null | |
| cake_day | date | not null |
Relationships
user_profiles.profile_subreddit_idreferencessubreddits.idusers.idreferencesuser_profiles