Can anybody explain to me why certain taxonomy terms end up in the Taxonomy Upgrade Extras field after upgrading to Drupal 7? I've searched around for this and found various answers, but I thought I'd ask myself to see if I could get a clearer answer. I tried using the queries suggested in this thread, but that didn't seem to get rid of all the Taxonomy Upgrade Extras. If anyone can give me some helpful advice as to how to deal with these fields it would be much appreciated, as it is one of the last issues preventing me from completing my D6 to D7 upgrade.

Comments

dswier’s picture

I find it rather disturbing that apparently nobody knows how this works.

rjlang’s picture

I, too, encountered this, and after some code- and db-spelunking, I have an explanation.

Back in D6, it was possible for a taxonomy term to be applied to a node even though the vocabulary to which the term belonged was NOT applied to the node. (For example, if you applied a term to a node and then subsequently disconnected its vocabulary from the node, the term stayed on the node.)

When D7 Taxonomy attempts its upgrade process, it tries to turn all of the old taxonomy vocabularies into new Field types; it assigns the resulting Fields to nodes that had the corresponding vocabularies attached. Then when a node has a taxonomy term from a vocabulary that was attached to it, at upgrade time, the node's new field for that vocabulary gets populated with a term entry.

But if a node has a term that comes from a vocabulary that wasn't attached to the node at upgrade time, the taxonomy upgrade module just throws it into the all-purpose, catch-all of taxonomy orphan terms that is "Taxonomy Upgrade Extras."

So first, if you had some random orphan taxonomy terms floating around before the upgrade, that's where you'll find them afterward.

But you may also find that entire taxonomies end up there. Two specific situations where that happens are for the FAQ module and for Ubercart's catalog taxonomy, at least, if you rigorously follow the D7 upgrade instructions. The reason it happens is that when you disable those modules (as you are instructed to do prior to the upgrade), the module removes the setting that tells Drupal which node type(s) the corresponding vocabularies go with. And so, when the upgrade happens, Taxonomy throws those terms into the orphanage, rather than creating all the field stuff it does with assigned vocabularies.

If this is what's happening to you (and it happened to me with FAQ and Ubercart), there's an easy fix, provided you're willing to start over with your migration process(*). After you disable the relevant modules, you reinsert the relevant connection information into the vocabulary_node_types db table. Here's how.

First, you need to find the vid of your vocabulary, which can be found by inspecting the vocabulary db table (e.g., with PHPMyAdmin). In the case of my FAQ module, its vid was 7. (Yours will, in general, be different.)

Then, after you disable the module in your upgrade sequence, you will reinsert an entry in the vocabulary_node_types table, e.g., execute the SQL query

INSERT INTO vocabulary_node_types VALUES (7, 'faq')

which (re)connects vocabulary 7 (my FAQ vocabulary) to node type 'faq' (that's the machine name of your node content type).

You can do this with Drush with the command

drush sql-query "INSERT INTO vocabulary_node_types VALUES (7, 'faq')"

Do this for all of the vocabularies that were ending up in the Taxonomy Upgrades Extras orphanage BEFORE you install the D7 code and run update.php (because all the upgrade magic will happen when you run update.php).

Hope this helps. Sorry for the length.

Robert

(*) Yay for scripting.

dswier’s picture

Thanks a lot for the detailed explanation. I actually went ahead and decided I could upgrade before I figured out my issue with taxonomy upgrade extras. Interestingly, when I did the upgrade for real I didn't have the same problem I did with my test upgrades. my content types kept their taxonomies as they were(even FAQ, which you mentioned and I did have problems with on my test upgrade). The difference may have been that I did not disable all modules before upgrading. I was following a guide that said to install core first and upgrade my database, then add in my contrib modules afterwards. So I now have a (mostly)stable Drupal 7 installation, and only one of my content types has taxonomy upgrade extras. Thankfully it's a vocabulary that did not require my immediate attention. Thanks again for the explanation.

ñull’s picture

Just a thought. Wouldn't it just be easier to make a backup of the vocabulary_node_types table and restore it before running update.php (or drush updb)?

Summit’s picture

Hi,
Interesting discussion.
I have three vocabularies terms in the Taxonomy upgrade extras vocabulary.
I would very much like to set them in their own vocabulary again..

greetings, Martijn

ptitwolfy’s picture

Is this somehow related to the "Save values additionally to the core taxonomy system (into the 'term_node' table)" option available in the field settings in D6?

Thanks

hockey2112’s picture

Robert,

I followed your steps, but only had limited success. I don't have any Taxonomy Upgrades Extras, but my Ubercart taxonomy drop-down (called "Shop") on the "edit product" page is empty. The strange thing is that the live view of the products DOES show the correct shop/taxonomy term.

Unfortunately, this means I cannot create new products or edit existing ones, since the taxonomy is required (and necessary). How can I fix this issue?

Thanks!

MattRowellPDX’s picture

I'm having the same issue, did you have any luck with a solution? I'm trying to avoid having to completely rebuild my store taxonomy vocabularies and manually re-assigning all categories to all of my products.

I followed the instructions in this thread which did help many of my Taxonomy terms to migrate correctly, however the ones associated with Ubercart have issues. On the front end, everything works fine and all of my filters and categories work, all of the products show on the correct categories. But when I edit a product, the dropdown to select a category is empty. There's also no association of a term reference on the Content Type, even though it shows the dropdown field on the product edit page. So it's kind of a ghost taxonomy that I can do nothing with.

Any ideas?

basvredeling’s picture

Thank you, this has been very helpful. Would you happen to know if there's an issue in the issue queue for the faq module (and the ubercart module) regarding this bug?

parth vora’s picture

@rjlang, thanks a tone buddy.

I was having the exactly same issue i.e unbercart clasess with vocabularies.

Just one small suggestion:
Instead of inserting each record manually in vocabulary_node_types, I did:
1) Export the table vocabulary_node_types data
2) Disable Ubercart which will remove those recored from the table
3) Truncate that table
4) Import that exported data back to the table

nedjo’s picture

The post https://drupal.org/node/1364354 by seanr contains an approach to fixing up the data breakage.