Closed bcardarella closed 2 months ago
votes
wanted_id foreign key to the wanteds table user_id foreign key to the users table
wanted_id
wanteds
user_id
users
on the wanteds table add
vote_count - int
vote_count
int
there should be a db trigger for each insert on the votes table that recalculates the related wanted.votes tally and sets that counter cace.
wanted.votes
No blockers
I'd like to take this up
I suggest naming the count column as vote_count so we can still do has_many :votes for User.
has_many :votes
User
votes
wanted_id
foreign key to thewanteds
tableuser_id
foreign key to theusers
tableon the
wanteds
table addvote_count
-int
there should be a db trigger for each insert on the
votes
table that recalculates the relatedwanted.votes
tally and sets that counter cace.No blockers