"Taxonomy post update make taxonomy term revisionable" fails

"Taxonomy post update make taxonomy term revisionable" fails

While updating this site to Drupal 8.7.2 from 8.6.15 I got Update aborted by: taxonomy post update make taxonomy term revisionable error. This happened after I executed drush updb command.

taxonomy_post_update_make_taxonomy_term_revisionable fails
taxonomy_post_update_make_taxonomy_term_revisionable fails

Taxonomy terms became revisionable in Drupal version 8.7, so function taxonomy_post_update_make_taxonomy_term_revisionable() is updating terms to be revisionable. But in my case it failed to do that. I tried to execute database updates multiple times but no luck. Then I decided to inspect the database.

After manual database inspection, I found that I had some data integrity issues, and these issues prevented function taxonomy_post_update_make_taxonomy_term_revisionable() from doing its job.

taxonomy_post_update_make_taxonomy_term_revisionable fails
taxonomy_post_update_make_taxonomy_term_revisionable fails

As you can see in the picture above, taxonomy terms #1 and #2 look weird. They have strange names, strange lang codes, and weights. I don't remember creating them, but since I know that I don't use these tags anywhere I decided to delete them to see if that will fix my problem. I deleted these terms from the following database tables: taxonomy_term__parent, taxonomy_term_data, taxonomy_term_field_data and taxonomy_term_hierarchy.

I tried executing drush updb again and this time it succeed. Yay!

taxonomy_post_update_make_taxonomy_term_revisionable fails
taxonomy_post_update_make_taxonomy_term_revisionable fails

So, if you have encountered the same problem try inspecting your database to find potential data integrity issues. Fixing those first and then executing database updates should make taxonomy_post_update_make_taxonomy_term_revisionable succeed.

If I can be of assistance, please do not hesitate to contact me.

About the author

Goran Nikolovski is a highly experienced Drupal developer with an extensive skill set that includes PHP, MySQL, HTML, CSS and Javascript. He has experience with large Drupal sites and Drupal Commerce 2.x integration, and he is author of several Drupal modules.