I have created a basic like system for my system. The likes are stored in the below format
user_id, post_id, liked_at
I want to keep the total likes in the database (as it will help in getting total post likes when retrieving post lists)
post_id, total_likes
I'm currently having 2 options for making these function.
- Creating a view to generate post-wise total likes
- Trigger to update total likes
what is the best way to go?