Score:2

What methods are available to resolve "The node.field_name field needs to be updated."?

mx flag
awm

When Drupal status report says field “field_name” needs to be updated I found out that it sometime hard to resolve. In the past we used to have entup but that was removed. The following works in many cases:

  1. Edit a field and resave then export it. This will add a missing schema property: this way you can tell what changed.
  2. Delete the configuration from the database and re-import it \Drupal::configFactory()->getEditable($name)->delete(). (not sure if this has bad side effects?)
  3. uninstall/reinstall a module (that;s not always possible).

However, how do I know what exactly need to be updated ? I looked in the code (entityUpdateManager) getChangeSummary can can’t figure out exactly what needs to be update. Is there a way? And could method #2 have any bad consequences?

cn flag
The easiest way is to go the storage settings admin page for the field and click "Save field settings". This invokes `::save()` on the field storage config entity, which seems to always sync things up properly. I've never actually tried it, but presumably if you need to do it programatically it's as simple as loading the entity and saving it again
awm avatar
mx flag
awm
I tried and I have it listed as option 1 in my question. It did not work for custom fields though. There is a `custom_storage` set to false for those fields. Wonder if it has anything to do with it. When you create a custom field should the `custom_stroage` key be true? and does `\Drupal::configFactory()->getEditable($name)->delete()` have any side effects?
cn flag
Apologies, I must've misread that as something different first time. `custom_storage` is for when you want to handle storing the field data yourself, i.e. Drupal won't store it in `node__field_foo` for you (the field Pathauto adds to entities is an example of this). A `ConfigEvents::DELETE` event is fired when you delete a config item using the API, so there could be side effects in theory, but core classes subscribing to that event don't look like they'd do anything that would cause problems. Contrib might be a different matter
Giuseppe avatar
br flag
There's a module that re-implement the `entup` functionality: https://www.drupal.org/project/devel_entity_updates . It clearly states in the home page issues why\when shouldn't be used.
Score:0
ph flag

In my similar case, I had Status error shows on /admin/reports/status :

node.field_hashtags field needs to be updated

I ended up checking the only content type that has hashtags enabled (Book Page) and just saved the storage settings at /admin/structure/types/manage/book/fields/node.book.field_hashtags/storage

The above fixed it. However, saving the same field storage using the devel module at /devel/config hadn't made any difference.

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.