Skip to main content

Have you come across the following Drupal error message:

Mismatched entity and/or field definitions. The following changes were detected in the entity type and field definitions.

Run a database update status check

drush updatedb:status --entity-updates

Response

 ------------------ ---------------------------------- --------------- ---------------------------------------------------------------------- 
  Module             Update ID                          Type            Description                                                           
 ------------------ ---------------------------------- --------------- ---------------------------------------------------------------------- 
  node entity type                                      entity-update   The node.field_objectives field needs to be updated.                  
  node               glossary_view_published            post-update     Add a published filter to the glossary View.                          
  views              remove_sorting_global_text_field   post-update     Clear caches due to removal of sorting for global custom text field.  
 ------------------ ---------------------------------- --------------- ---------------------------------------------------------------------- 

In my situation I had a missing module.  The irony here, was the offending module was migrate_tools which in Drupal 9 is no longer required.  As the migrate tools have become apart of core.  Once I added the file, I was able to update a correct the error.

This can be tested again by running the same status command again.

drush updatedb:status --entity-updates

The results show no errors.  Now it is time to run the update db command.

drush updb

Response

 -------- ------------------ ------------- -------------------------------- 
  Module   Update ID          Type          Description                     
 -------- ------------------ ------------- -------------------------------- 
  node     glossary_view_pu   post-update   Add a published filter to the   
           blished                          glossary View.                  
  views    remove_sorting_g   post-update   Clear caches due to removal of  
           lobal_text_field                 sorting for global custom text  
                                            field.                          
 -------- ------------------ ------------- -------------------------------- 

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

>  [notice] Update started: node_post_update_glossary_view_published
>  [notice] Update completed: node_post_update_glossary_view_published
>  [notice] Update started: views_post_update_remove_sorting_global_text_field
>  [notice] Update completed: views_post_update_remove_sorting_global_text_field
 [success] Finished performing updates.

 

Not working for you?

For some sites, the above commands solved the issue.  However, on another site... not working.

 ------------------ ----------- --------------- -------------------------------
  Module             Update ID   Type            Description
 ------------------ ----------- --------------- -------------------------------
  node entity type               entity-update   The node.field_topics field
                                                 needs to be updated.
  user entity type               entity-update   The
                                                 user.field_pending_expire_sen
                                                 t field needs to be updated.
 ------------------ ----------- --------------- -------------------------------

In this instance, I tried a different approach and focus on applying the pending updates.  Use the command:

drush entity:updates

Or alias commands

drush entup
drush entity-updates

Response from using one of the above commands:

The following updates are pending:

node entity type :
The node.field_topics field needs to be updated.
user entity type :
The user.field_pending_expire_sent field needs to be updated.

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

Press return to continue

Successful response

 [success] Finished performing updates.

 

Related articles