subreddit_karma table
The subreddit_karma table in the Reddit Clone Database Schema schema has 5 columns, with 2 foreign keys to users and subreddits.
A rollup of karma_events per community, kept because AutoMod checks it on every single submission and a live aggregate there would be the slowest thing on the site.
Columns (5)
| Column | Type | Constraints | Description |
|---|---|---|---|
| user_id | uuid | not null, references users.id | |
| subreddit_id | uuid | not null, references subreddits.id | |
| post_karma | integer | not null | |
| comment_karma | integer | not null | |
| updated_at | timestamptz | not null |
Indexes (1)
(subreddit_id, comment_karma)
Relationships
subreddit_karma.user_idreferencesusers.idsubreddit_karma.subreddit_idreferencessubreddits.id