I am building a social networking website, so I wanted to know how to store i.e. the database structure for storing likes and comments of a post.
I have created a table post for storing posts but I want to know how to store "likes" and "comments" so that I can show who are the people who liked your post and what are the comments of the post.
Do I need to create a table for likes which stores user id of every user who liked the post and post_id as foreign key, but this may be very large table as it will create a new row for every user who liked the post. For example if one post has 1000 likes then it will create 1000 rows for the same post in "like" table. The same thing happens with comments as well.
Please suggest me the table structure for post, like and comments. Thanks!