0

I'm upgrading a site from Drupal 8 to 9. In its Drupal 8 version it used the field_collection module. There are some fields that still exist in some ghostly manner, that depend on the field_collection module. How can I get rid of these fields? The usual advice is to reinstall the missing module but I cannot reinstall field_collection as it is not compatible with Drupal 9.

Here's what I see on the status page:

Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Content
The node.field_committee_with_position field needs to be uninstalled.
The node.field_councillor_with_pos field needs to be uninstalled.
The node.field_meeting_timetable field needs to be uninstalled.

What I've tried:

  1. Running cron (has no effect)
  2. Trying to delete the fields using drush
drush config:delete field.field.node.field_committee_with_position
 [error]  Config field.field.node.field_committee_with_position does not exist 

(This was confirmed by doing an config export and seeing that no yaml files were created for those fields)

  1. Installing the devel_entity_updates module and then running dentup:
$ drush dentup
The following updates are pending:

node entity type : 
The node.field_committee_with_position field needs to be uninstalled.
The node.field_councillor_with_pos field needs to be uninstalled.
The node.field_meeting_timetable field needs to be uninstalled.

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

But after pressing Enter I get an error message which begins:

The "field_item:field_collection" plugin does not exist.

This is a dev site and I'm confident with running SQL commands so if there's a way I can just blitz these fields out of the database please let me know.

1 Answer 1

0

I had a similar issue where we removed a module, yet fields remained. The only solution that I found was to do the following:

  1. Open the DB in a DB management tool (I preferred a tool with GUI)
  2. Delete the node.field_name table
  3. Delete the node.revision_field_name table
  4. Go to the config table, find the row related to field_name and delete it
  5. Delete all cache related tables
  6. Clear the cache again, just in case (I guess you can do only one of the two steps - 5 or 6)
  • Make a backup of your DB before attempting
  • Change field_name with the field that you want to remove

Hope it helps. Best of luck!

4
  • Hi @VelizaStavrev, thanks for the answer. I did everything you said but the fields are still appearing on the status report! There were no entries for them in the config table but I dropped the node__field_* and node_revision__field_* tables for each field and I cleared the cache via drush and via the GUI and truncated all the cache__* tables as well.
    – naomi
    Jul 15, 2022 at 8:35
  • I also ran cron and cleared the cache again afterwards. Still showing on status page!
    – naomi
    Jul 18, 2022 at 12:10
  • I guess you already tried searching for them in the config table with the built in search by key words, not the full field name? I used DBeaver, couldn't do a good search with Heidi when trying. If that helps. Jul 19, 2022 at 18:55
  • Thanks @ValizarStavrev. I am using the command line, but I did this, which is equivalent: select * from config where data like "%committee_with%"; select * from config where name like "%committee_with%"; select * from config where collection like "%committee_with%" - they all returned nothing
    – naomi
    Jul 20, 2022 at 16:32

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.