comment_votes table
The comment_votes table in the Reddit Clone Database Schema schema has 5 columns, with 2 foreign keys to users and comments.
Kept separate from post_votes rather than unified behind a content_type column, because these two are the hottest write path in the product and each deserves its own index and its own partitioning story.
Columns (5)
| Column | Type | Constraints | Description |
|---|---|---|---|
| user_id | uuid | not null, references users.id | |
| comment_id | uuid | not null, references comments.id | |
| value | smallint | not null | |
| created_at | timestamptz | not null | |
| updated_at | timestamptz | not null |
Indexes (1)
(comment_id)
Relationships
comment_votes.user_idreferencesusers.idcomment_votes.comment_idreferencescomments.id