3

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?

4
  • 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
    – Clive
    Dec 17, 2021 at 20:31
  • 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?
    – awm
    Dec 17, 2021 at 21:12
  • 1
    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
    – Clive
    Dec 18, 2021 at 0:42
  • There's a module that re-implement the entup functionality: drupal.org/project/devel_entity_updates . It clearly states in the home page issues why\when shouldn't be used.
    – Giuseppe
    Aug 9, 2023 at 8:00

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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