poll_votes table
The poll_votes table in the Reddit Clone Database Schema schema has 3 columns, with 2 foreign keys to users and poll_options.
Separate from post_votes because a poll choice is not an upvote and must never touch karma. vote_count on poll_options is the cache over this table.
Columns (3)
| Column | Type | Constraints | Description |
|---|---|---|---|
| user_id | uuid | not null, references users.id | |
| option_id | uuid | not null, references poll_options.id | |
| voted_at | timestamptz | not null |
Indexes (1)
(option_id)
Relationships
poll_votes.user_idreferencesusers.idpoll_votes.option_idreferencespoll_options.id