Score:3

Details wanted for "Mismatched entity and/or field definitions" message on custom field

in flag

I have developed a custom Drupal field.

All works fine. We are already using the field in production for a year. But the status report for exactly this field says:

Mismatched entity and/or field definitions

I would like to get rid of that message. It gives me a bad feeling about the reliability of my Drupal installation.

I could write an update hook if I knew in detail what is wrong.

How can I find out what exactly does not match?

4uk4 avatar
cn flag
It's unclear why you want to get rid of this message. Normally you develop a new module and then deploy it, which means install the module in different environments and import configurations. If this is about an already deployed module you need an update hook for the database schema updates. If you want to get rid of this message in your dev environment you can either re-install the module or use https://www.drupal.org/project/devel_entity_updates
in flag
Thanks for you comment, @4k4. I have edited my answer and explained that the field is in use in production and that the error message makes me fear that the Drupal installation is not reliable.
Score:3
cn flag

OK, if this happened in production you probably had a code change in FieldItemInterface::schema().

The most detailed information you get is from

\Drupal::entityDefinitionUpdateManager()->getChangeList()

returning a list of entity fields affected and the status 1,2 or 3. If your field is listed with 2 (DEFINITION_UPDATED) then check your code history for schema changes. If you don't have a code history you could check the current state of the database table(s). If you don't see the changes then install the module on a fresh site and compare the created tables.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.