How to combine tags in an existing system

We have a simple interface for marking a specific issue.

(e.g. entry has 1..many tags and each tag entry has a foriegn key pointer back to the entry table)

1.    What is the current production version of the jdk? (Tags: jdk6 jdk-6 jdk java)
2.    In what version was java.util.spi package introduced? (Tags: jdk-6, jdk7, jdk5)
3.    Which version of java is going to be released soon? (Tags: jdk-6, jdk7, jdk8)

We would like to combine all the tags with the name "jdk-6" in jdk6. How do we achieve this in a system that approaches production but contains useful data.

In [1], jdk-6 must be deleted, since jdk6 is already present. In [2,3], jdk-6 must be renamed to "jdk6".

What scenarios do I need to efficiently migrate this data.

EDIT

create table entry (id, question, ...)
create table entry_tag (id, entry_id, tag)
+5
source share
3 answers

I would do the following:

  • Refresh bad tags with good ( UPDATE TagTable SET Tag = 'jdk6' WHERE tag = 'jdk-6')

  • ( entry_id ). , , , , Google , .

  • , tagList , jdk-6 (DELETE FROM TagsList WHERE Tag = 'jdk-6').

+2

, "jdk-6", "jdk6".

"jdk6" "jdk-6".

, .

0
/* Step 1 - Delete where both tags exist */
delete from et1
    from entry_tag et1
        inner join entry_tag et2
            on et1.entry_id = et2.entry_id
                and et2.tag = 'jdk6'
    where et1.tag = 'jdk-6'

/* Step 2 - Update remaining tags */
update entry_tag
    set tag = 'jdk6'
    where tag = 'jdk-6'
0

All Articles