Created
January 31, 2024 17:20
-
-
Save wont-work/e95684b80ba89849db1e4a46edbc59f7 to your computer and use it in GitHub Desktop.
the cursed sql to convert all heart reactions to star reactions in misskey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN; | |
UPDATE note_reaction | |
SET reaction='⭐' | |
WHERE reaction='❤'; | |
UPDATE note | |
SET reactions = jsonb_set(reactions, '{⭐}', ((reactions->>'❤')::int + coalesce((reactions->>'⭐')::int, 0))::text::jsonb) | |
WHERE (reactions->>'❤')::int >= 0; | |
UPDATE note | |
SET reactions = reactions - '❤' | |
WHERE (reactions->>'❤')::int >= 0; | |
update note | |
set "reactionAndUserPairCache" = array(select replace(unnest("reactionAndUserPairCache"), '❤', '⭐')) | |
where "reactionAndUserPairCache" != '{}'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment