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)

Columns of the user_profiles table
ColumnTypeConstraintsDescription
user_iduuidprimary key
display_namevarchar(30)
about_mdvarchar(1000)
avatar_urlvarchar(500)
banner_urlvarchar(500)
snoovatar_urlvarchar(500)
profile_subreddit_iduuidreferences subreddits.id
is_nsfwbooleannot null
accepts_direct_messagesbooleannot null
accepts_chat_requestsbooleannot null
show_karmabooleannot null
cake_daydatenot null

Relationships