ElixirMostWanted / elixirmostwanted.com

60 stars 9 forks source link

Votes table and vote counter cache #10

Closed bcardarella closed 2 months ago

bcardarella commented 4 months ago

votes

wanted_id foreign key to the wanteds table user_id foreign key to the users table

on the wanteds table add

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.

No blockers

Alvinkariuki commented 4 months ago

I'd like to take this up

aptinio commented 4 months ago

I suggest naming the count column as vote_count so we can still do has_many :votes for User.