Resource icon

Prune all likes (queries)

Admin

Administrator
Staff member
Joined
Sep 28, 2017
Messages
1,529
Reactions
110
Points
63
Admin submitted a new resource:

Prune all likes (queries) - Prune all likes (queries)

Description: an example of SQL-queries to prune all likes.

Before you perform any action with the database, don't forget to backup!

Queries are executed sequentially:
PHP:
DELETE FROM xf_liked_content;
PHP:
UPDATE xf_user AS u
SET like_count = (
SELECT COUNT(*)
FROM xf_liked_content AS lc
WHERE lc.content_user_id = u.user_id
GROUP BY lc.content_user_id
);
PHP:
UPDATE xf_post SET likes = 0, like_users = 0x613a303a7b7d;
Read more about this resource...