We have a simple interface to tag a particular question
(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 merge all tags named as "jdk-6" to jdk6. How do we achieve this in a system which is nearing production but contains useful data.
In [1] jdk-6 needs to be removed, since jdk6 is already present. In [2,3] jdk-6 needs to be renamed as "jdk6".
What kind of scripts do I need to migrate this data in a effective fashion.
EDIT
create table entry (id, question, ...)
create table entry_tag (id, entry_id, tag)
I would do the following:
Update the "bad" tags with the good one (UPDATE TagTable SET Tag = 'jdk6' WHERE tag = 'jdk-6'
)
Remove the duplicate tags (where entry_id and Tag are the same) . Exactly how you do this will depend on whether you have a separate unique key on the table or not, but a quick google will provide you with a variety of methods that work under different circumstances.
Assuming you have a TagsList table with the list of all available tags, remove jdk-6 from it (DELETE FROM TagsList WHERE Tag = 'jdk-6'
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With