Now likes are stored together with posts in the form of a field of type BLOB. On the one hand it is reasonable, as allows to store set of the data practically without redundancy. On the other hand such storage does not allow to use this data in mathematical operations in queries. It essentially restricts usefulness of the given possibility.
If to store likes in the separate table, it creates one more superfluous query. But at the same time allows:
1. To produce mathematical operations in queries (for an example: SUM, MAX)
2. Adds possibility of usage not only "Likes", but also "Unlike". Now is only "Likes" also anything. System of pluses/minuses.
3. It is possible to select separately a thread (the first post in a thread) and other posts.
4. The extension of the rights for usage likes it is possible to achieve restriction of maximum usage like per hour, per day etc. Also it is possible to disconnect, for example, usage in some thread or a forum "Likes" or only "Unlike". Combinations there can be a set.
5. The aforesaid as a result allows to create rating system.
6. It is possible at review of the list by that at once to select threads which typed the greatest quantity of pluses.
7. Etc.
Thus, in the table xf_likes should be stored:
like_id
user_id
thread_id
post_id
like_date
like_value
like_notice
If to store likes in the separate table, it creates one more superfluous query. But at the same time allows:
1. To produce mathematical operations in queries (for an example: SUM, MAX)
2. Adds possibility of usage not only "Likes", but also "Unlike". Now is only "Likes" also anything. System of pluses/minuses.
3. It is possible to select separately a thread (the first post in a thread) and other posts.
4. The extension of the rights for usage likes it is possible to achieve restriction of maximum usage like per hour, per day etc. Also it is possible to disconnect, for example, usage in some thread or a forum "Likes" or only "Unlike". Combinations there can be a set.
5. The aforesaid as a result allows to create rating system.
6. It is possible at review of the list by that at once to select threads which typed the greatest quantity of pluses.
7. Etc.
Thus, in the table xf_likes should be stored:
like_id
user_id
thread_id
post_id
like_date
like_value
like_notice
Upvote
0