1

I have just tested the update to 8.7.1 (from 8.6.x) which includes the removal of the old automatic entity update functionality, which means drush entup no longer works. As far as I understand the change record, developers now need to perform the updates inside update hooks. However, after updating the core with composer and performing the database update (which ran without any errors), I get a warning in the status report:

The following changes were detected in the entity type and field definitions.
taxonomy_term entity type :
The Moderation state field needs to be installed.

But without the drush entity-update, I have no idea what I'm supposed to do here. How do I perform the update? Drush dbup ran successfully (and now reports no outstanding updates), which drush entup doesn't work anymore. How can I handle this error?

For the record, this is the output of the first drush updb, not sure if it's relevant:

server:~/httpdocs$ drush updb
 ------------------- ----------------------------------------------- --------------- ----------------------------------------------------------------------------- 
  Module              Update ID                                       Type            Description                                                                  
 ------------------- ----------------------------------------------- --------------- ----------------------------------------------------------------------------- 
  system              8701                                            hook_update_n   Remove the unused 'system.theme.data' from state.                            
  system              8702                                            hook_update_n   Add the 'revision_translation_affected' entity key.                          
  file                8700                                            hook_update_n   Set the 'owner' entity key and update the field.                             
  node                8700                                            hook_update_n   Set the 'owner' entity key and update the field.                             
  taxonomy            8701                                            hook_update_n   Add an index on the 'taxonomy_term__parent' field table.                     
  menu_link_content   make_menu_link_content_revisionable             post-update     Update custom menu links to be revisionable.                                 
  system              add_expand_all_items_key_in_system_menu_block   post-update     Initialize 'expand_all_items' values to system_menu_block.                   
  system              clear_menu_cache                                post-update     Clear the menu cache.   @see https:www.drupal.orgprojectdrupalissues3044364  
  system              fix_jquery_extend                               post-update     Clear the library cache and ensure aggregate files are regenerated.          
  taxonomy            make_taxonomy_term_revisionable                 post-update     Update taxonomy terms to be revisionable.                                    
  taxonomy            remove_hierarchy_from_vocabularies              post-update     Remove the 'hierarchy' property from vocabularies.                           
  views               exposed_filter_blocks_label_display             post-update     Update exposed filter blocks label display to be disabled.                   
  views               make_placeholders_translatable                  post-update     Rebuild cache to allow placeholder texts to be translatable.                 
 ------------------- ----------------------------------------------- --------------- ----------------------------------------------------------------------------- 

 Do you wish to run the specified pending updates? (yes/no) [yes]:
 > yes

 [notice] Update started: system_update_8701
 [ok] Update completed: system_update_8701
 [notice] Update started: system_update_8702
 [ok] Update completed: system_update_8702
 [notice] Update started: file_update_8700
 [ok] Update completed: file_update_8700
 [notice] Update started: node_update_8700
 [ok] Update completed: node_update_8700
 [notice] Update started: taxonomy_update_8701
 [ok] Update completed: taxonomy_update_8701
 [notice] Update started: menu_link_content_post_update_make_menu_link_content_revisionable
 [notice] Custom menu links have been converted to be revisionable.
 [ok] Update completed: menu_link_content_post_update_make_menu_link_content_revisionable
 [notice] Update started: system_post_update_add_expand_all_items_key_in_system_menu_block
 [ok] Update completed: system_post_update_add_expand_all_items_key_in_system_menu_block
 [notice] Update started: system_post_update_add_expand_all_items_key_in_system_menu_block
 [ok] Update completed: system_post_update_add_expand_all_items_key_in_system_menu_block
 [notice] Update started: system_post_update_clear_menu_cache
 [ok] Update completed: system_post_update_clear_menu_cache
 [notice] Update started: system_post_update_fix_jquery_extend
 [ok] Update completed: system_post_update_fix_jquery_extend
 [notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Taxonomy terms have been converted to be revisionable.
 [ok] Update completed: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Taxonomy terms have been converted to be revisionable.
 [ok] Update completed: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Taxonomy terms have been converted to be revisionable.
 [ok] Update completed: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Taxonomy terms have been converted to be revisionable.
 [ok] Update completed: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Taxonomy terms have been converted to be revisionable.
 [ok] Update completed: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Taxonomy terms have been converted to be revisionable.
 [ok] Update completed: taxonomy_post_update_make_taxonomy_term_revisionable
 [notice] Update started: taxonomy_post_update_remove_hierarchy_from_vocabularies
 [ok] Update completed: taxonomy_post_update_remove_hierarchy_from_vocabularies
 [notice] Update started: views_post_update_exposed_filter_blocks_label_display
 [ok] Update completed: views_post_update_exposed_filter_blocks_label_display
 [notice] Update started: views_post_update_exposed_filter_blocks_label_display
 [ok] Update completed: views_post_update_exposed_filter_blocks_label_display
 [notice] Update started: views_post_update_make_placeholders_translatable
 [ok] Update completed: views_post_update_make_placeholders_translatable
 [success] Finished performing updates.
2

One option is to use the new Devel Entity Updates module, which was built for this exact purpose:

In #2976035: Entity type CRUD operations must use the last installed entity type and field storage definitions the ability to run drush entup was removed, see the related change record for more details. This project aims to restore this functionality as a developer-only tool. This module depends on Devel and is not meant to be enabled in production environments or relied upon in deployment workflows.

  • Thanks, though I think that's a workaround, I'd still like to know if there's an "official" way this is supposed to be resolved. – MoritzLost May 16 at 14:00
  • 1
    The official way is for modules relying on the old way to explicitly write the code to make the updates happen in hook_update_N. All the gritty details are here: drupal.org/node/3034742 – Clive May 16 at 14:15
  • Thanks! I thought that, but I was confused because I assumed the error was coming from the core and wondered if I had forgotten a step when updating. But apparently it's coming from workbench moderation, so I'll just need to wait until they come through with an update. – MoritzLost May 16 at 14:20
  • 1
    ah ok, yeah I was wondering the same thing actually, seems like the sort of thing core would've solved before releasing! – Clive May 16 at 14:22
1

Put it in an update hook again. Put it in the your_module_name.install file. (Make sure it existed already in the module when installed, otherwise put it in an other modules install file)

/**
 * Update- Create your_entity_name entity.
 */
function your_module_name_update_8002() {
  //check if the table exists first.  If not, then create the entity.
  if(!db_table_exists('your_entity_name')) {
    \Drupal::entityTypeManager()->clearCachedDefinitions();
    \Drupal::entityDefinitionUpdateManager()
      ->installEntityType(\Drupal::entityTypeManager()->getDefinition('your_entity_name'));
  }
  else {
    return 'your_entity_name entity already exists';
  }
}
0

As pointed out by @MoritzLost, relying on drush entup is a workaround. The proper solution would be to rely on the WBM patch or wait for it to be released before updating to 8.7. More details available at https://www.drupal.org/project/devel_entity_updates/issues/3082442.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.