fix: correct community category migration rank

This commit is contained in:
hajimi
2026-08-02 17:50:04 +08:00
parent b0b278d11f
commit 01ca642b4d
2 changed files with 4 additions and 4 deletions
@@ -124,12 +124,12 @@ INNER JOIN (
ROW_NUMBER() OVER (
PARTITION BY post_tag.`post_id`
ORDER BY tag.`sort` DESC, post_tag.`id` ASC
) AS row_number
) AS `post_rank`
FROM `la_community_post_tag` post_tag
INNER JOIN `la_community_tag` tag ON tag.`id` = post_tag.`tag_id`
INNER JOIN `la_community_post_category` category ON category.`id` = post_tag.`tag_id`
) ranked
WHERE ranked.row_number = 1
WHERE ranked.`post_rank` = 1
) selected_category ON selected_category.`post_id` = post.`id`
SET post.`category_id` = selected_category.`category_id`
WHERE post.`category_id` = 0;