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
  • taxonomy_term_hierarchy.

I tried executing drush updb again and this time it succeeds. 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.