user_trophies table

The user_trophies table in the Reddit Clone Database Schema schema has 5 columns, with 4 foreign keys to users, trophies and subreddits.

subreddit_id is part of the key because a community trophy can be earned once per community, while a site trophy is earned once overall with a null there.

Columns (5)

Columns of the user_trophies table
ColumnTypeConstraintsDescription
user_iduuidnot null, references users.id
trophy_iduuidnot null, references trophies.id
subreddit_iduuidreferences subreddits.id
granted_byuuidreferences users.id
awarded_attimestamptznot null

Indexes (1)

  • (trophy_id)

Relationships