Feature to merge multiple tags #688
cweiske
started this conversation in
Ideas & Feature Requests
Replies: 2 comments
-
I renamed the title to reflect the actual idea, which is a great one. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I would love this feature as well. For the time being, here are some SQL queries if you are willing to do it manually. Swap out tag 'A' with the tag you want to merge everything into, and replace 'B' and 'C' with all the tags you wish to merge from. -- Add tag 'A' to all links where 'B' or 'C' is present
-- Updating doesn't work due to the compound primary key causing duplicates,
-- its easier to just add the required tag where required, and delete the
-- old ones afterwards
INSERT INTO link_tags (link_id, tag_id)
SELECT
lt.link_id,
ta.id
FROM
link_tags lt
JOIN
tags tb
ON lt.tag_id = tb.id AND tb.name IN('B', 'C')
JOIN
tags ta
ON ta.name = 'A'
WHERE
NOT EXISTS (
SELECT
1
FROM
link_tags lt2
WHERE
lt2.link_id = lt.link_id
AND lt2.tag_id = ta.id
)
;
-- Delete 'B' and 'C' tag associations
DELETE FROM link_tags
WHERE tag_id IN (SELECT id FROM tags WHERE name IN ('B', 'C'));
-- Delete 'B' and 'C' tags
-- Making sure only to delete them if there are absolutely no remaining associations
DELETE FROM tags
WHERE name IN ('B', 'C') AND id NOT IN (SELECT tag_id FROM link_tags); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I imported ~1600 bookmarks from my semanticscuttle installation.
Via the "Recent tags" view I found some typos and wanted to correct them.
One of the typo'd tags was "firefix", which I wanted to rename to "firefox". When saving, I get the error
It would be nice if I got asked if I wanted to merge those tags.
(Deleting the tag from a link and replacing it with the correct one is possible, but becomes tedious when you have more than a couple of links with that typo'd tag)
Beta Was this translation helpful? Give feedback.
All reactions