5

I'm getting the following error on my Drupal 8 configuration page.

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

Content Update the node.rng_capacity field. Update the node.rng_registrants_duplicate field. Update the node.rng_registration_groups field. Update the node.rng_registration_type field. Update the node.rng_reply_to field. Update the node.rng_status field.

I'm not sure what caused these issues or how to go about resolving them. I think they may be leftover fragments/elements from when I deleted a registration or entity type.

5
  • 1
    The message shouldnt mean there isnt anything bad going on. Running drush entity-updates on your site should cancel these messages.
    – Daniel
    Apr 21 '16 at 17:42
  • What else did you try? drush updb?
    – leymannx
    Jun 14 '19 at 21:41
  • Hi, yes I tried both drush updb and drush entup. Entup would say success each time I ran it, but never seemed to update and it was there next time. Let me test the comments of the other answer - devel entity updates module. Thanks. Jun 16 '19 at 15:39
  • You should never use drush entup for core updates. Always use drush updb. If this fails it would be a major core issue. In this case restore from a backup and wait for a fix which shouldn't take long because it would affect a lot of installations.
    – 4k4
    Jun 16 '19 at 19:44
  • Duly noted for the future thanks, Unfortunately I'd already ran Drush EntUp with the devel module installed but it seemed to sort the issue. Hopefully nothing that will later come back to bite me. Jun 17 '19 at 21:01
11

You can solve this issue by two ways.

If you installed Drush, you can run drush entity-updates. Otherwise, add the following lines in the index.php file located in the Drupal root folder, before $response->send(); and reload the page.

try {
  \Drupal::entityDefinitionUpdateManager()->applyUpdates();
}
catch (EntityStorageException $e) {
  print_r($e);
}

Then remove the code from the index.php file.

6
  • Can you post drush comment warning or error here? So I can figure out what is the problem exactly.
    – Rahul
    Dec 5 '16 at 4:01
  • I deleted my comment, the problem was with the PHP version my drush was using ( I had two versions, shell was using the old one, so drush was too). Thanks!
    – Chayemor
    Dec 6 '16 at 10:18
  • If anyone comes seeking this question how to change PHP version under which drush is running you can find this article helpful. <a href="fuelforbrain.com/… to change PHP version that drush runs under?</a>
    – Rahul
    Dec 7 '16 at 7:25
  • I had this problem after updating from Drupal 8.3.2 to 8.3.3, but in my fields contained already data. <blockquote>The SQL storage cannot change the schema for an existing field</blockquote> Is there no simple way to update field storage and solve this mismatched entity error when there is already data in the fields?
    – drupalfan
    Jun 17 '17 at 11:18
  • Drush didn't work in my case for some reason, but I was able to use drupal update:entities instead.
    – Gruffy
    Jul 26 '18 at 8:33
12

drush entity-updates (aka drush entup) has been deprecated as of Drupal 8.7.0. You either need to write an update script using hook_update_N(), or you can use the Devel Entity Updates module, which does the same thing as drush entup did previous to 8.7.0.

2
  • Many thanks Jaypan. First I've heard of this solution, but it worked perfectly. Installed the Devel Entity Updates Module you recommended and then ran drush entup again. This time it worked! I did vote up the answer, but because my rep is so low it's not display. Cheers Jun 16 '19 at 16:01
  • Thanks a lot, Jaypan. Working perfectly. Your answer is always helpful. Feb 26 at 12:37
1

For Drupal 8 and Drupal 9, there is the Entity Update module, which allows to update an entity schema with Drush or without it.

The main objective of this module is to allow module developers and site administrators to update entity types schema even when entities have data.
The update can be executed via Drush (recommended), from the web browser, or programmatically.
The module also allows to view the list of entity types, the entity types update status, and show the content of an entity type.

1

Find the field in /admin/reports/fields. For each entity that uses the field, edit the field and save the parameters again.

This should be updating the database and make the entity and the field match again.

1
  • This even works when the field in question is layout_builder__layout which is locked.
    – berliner
    Nov 24 at 23:16
0

For Drupal 9, use devel_entity_updates module

composer require 'drupal/devel_entity_updates'
drush en devel_entity_updates
drush entity-updates

should fix the issue.

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.