I've been tasked with tightening up our site's taxonomy. Unfortunately, this includes yet another desire that cannot be met with any of the default tools available in Drupal (and noone has quite hit the mark with a module): Gather terms from multiple vocabularies into one single vocabulary and do it in such a way as to avoid recategorizing the thousands of nodes we have that have already been categorized using the existing terms. The reason for this was that all the vocabulary names could be seen as one.
(Note: These instructions do NOT account for Relationships or Synonyms... so if your site uses them, you'll have to modify these instructions to suit your needs.)
Disclaimer: BYODD (BACKUP YOUR DATABASE, DUMMY!) before attempting any instructions on this site. Owners AND all Affiliates are NOT responsible for anything YOU screw up by following any instructions you find here.
This is an example of what the vocabularies looked like before:
Three vocabularies - Acorns, Chestnuts, and Walnuts:
Acorns - Spanish - North African Chestnuts - American - European - Chinese - Chosun Walnuts - English - Black - Butternut
After my work they simply get moved into another vocabulary called "Nuts" with the added bonus of being able to move the terms into parent terms named by the original Vocabulary names (this is NOT an automatic process but instead will help to maintain a hierarchy similar to what you had before.... and will keep the terms organized - To make this happen, create the destination parent terms immediately after creating the destination Vocabulary). This is what you get after ("Nuts" being the new vocabulary name):
Nuts -Acorns -- Spanish -- North African -Chestnuts -- American -- European -- Chinese -- Chosun -Walnuts -- English -- Black -- Butternut
After you create the 3 parent terms Acorns, Chestnuts, and Walnuts, run the following queries:
select t.vid to_vocab, t.tid new_parent, v.vid from_vocab from term_data t, vocabulary v, term_hierarchy h where t.name=v.name and t.tid=h.tid and h.parent=0 and v.name="acorns";
Results will be similar to:
+----------+------------+------------+ | to_vocab | new_parent | from_vocab | +----------+------------+------------+ | 2 | 8 | 5 | | 23 | 4777 | 5 | +----------+------------+------------+
As you see, in the last line, the vocabulary name we're focused on is "acorns". So when it's time to move other vocabularies, just change that string.... As long as the destination parent term is in place and spelled the same, you can move limitless "source" terms to the destination that you've set up
Here you see the IDs for the destination vocabulary, the parent term in that vocabulary, and the source vocabulary. If you have more than one row in the result set, that's only because there are multiple vocabularies with a term name identical to the source vocabulary name. If you JUST created the destination vocabulary, then you'll want to use the 'to_vocab' with the highest number. In my case, I wanted to move the terms to one that was erroneously ignored by the Drupaler who created the Acorns vocab. So looking back at my taxonomy page and mousing over a few links, I figured out that my actual destination was vocabulary ID 2.
Here's the "move" query to do the work:
update term_data d, term_hierarchy h set d.vid=2, h.parent=8 where h.tid=d.tid and d.vid=5;
That's IT! I know this is a highly manual process.. and you'll have to have some familiarity with running queries against your database. But until I or anyone else has the chance to build it out and expand it as a module, this is all you'll get. :-D Hope it works well for you.