when updating from 8.5.x to 8.6.1, an error happened when running one of the database update instructions. More precisely, the error occurs when Drupal is trying to run function taxonomy_update_8502().

This is the error message I get.

Update #8502
Failed: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydbname.taxonomy_term_hierarchy' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {taxonomy_term_hierarchy} taxonomy_term_hierarchy) subquery; Array() in taxonomy_update_8502() (line 37 of /var/www/html/core/modules/taxonomy/taxonomy.install).

I can see why the error is happening. The taxonomy_term_hierarchy table doesn't exist any longer in the database and this database update is trying to remove it. Reading about this issue, I found that Drupal 8.6.x moves data from the old table (taxonomy_term_hierarchy) into the new table (taxonomy_term__parent).

Something must have halted the database update, and Drupal thinks the update function hasn't executed, but I can see on the new taxonomy_term__parent table is there. Perfect! So I still have pending updates I need to run, and now I need taxonomy_update_8502() to get out of my way.

How can I tell Drupal to forget that database update, or just ignore it, or even artificially consider it has ran already? Is there something I can do in that regard, like definitely skipping a database update?

  • Take a look at this question , may use drush pm-update --lock=taxonomy . – berramou Oct 17 at 21:07
  • Uhmmm, thank you for sharing this hint. I will probably be able to try this fix tomorrow. Do you know if this instruction will permanently 'forget' about the failed update, or will it keep it in standby waiting for the next time I have to run a database update? If the latter is the case, I will have to run updates all the time with this --lock instruction and I will definitely have problems when the Taxonomy module issues a new database update. – Marcos Buarque Oct 19 at 1:36
  • If the issue comes from something odd from your database, you should always run the update with --lock , other wise if the issue comes from Taxonomy Module in the 8.6.1 version, you should open an issue to the Taxonomy issue queue, after the issue fixed and committed you won't need --look anymore, did you try to update from 8.5.x to 8.6.1 in fresh install to see if the issue from your db or in the taxonomy module? – berramou Oct 19 at 8:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.