0

I recently uninstalled a module and it left behind a bit of a mess in the database. Running drush entup lists a number of fields related to this module that need to be uninstalled across a few entity types.

This fails, though. In addition to these field definitions there are a number of other tables that didn't get removed.

How can I clean this up? I'm comfortable manipulating the database and I'm able to find the fields. I'm just unsure of how to clean it up to satisfy drush entup so it stops listing it as a pending action.

Edit-Including Error:

The following updates are pending: node entity type : The Lingotek translation source field needs to be uninstalled. The Lingotek translation status field needs to be uninstalled. menu_link_content entity type : The Lingotek document id field needs to be uninstalled. The Lingotek hash field needs to be uninstalled. The Lingotek profile field needs to be uninstalled. The Lingotek translation source field needs to be uninstalled. The Lingotek translation status field needs to be uninstalled. The Lingotek translation created time field needs to be uninstalled. paragraph entity type : The Lingotek document id field needs to be uninstalled. The Lingotek hash field needs to be uninstalled. The Lingotek profile field needs to be uninstalled. The Lingotek translation source field needs to be uninstalled. The Lingotek translation status field needs to be uninstalled. The Translation changed time field needs to be uninstalled. Do you wish to run all pending updates? (y/n): y Drupal\Core\Entity\EntityStorageException: The field lingotek_translation_source has already been deleted and it is in the process of being purged. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionDelete() (line 512 of [error] /docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php). Failed: Drupal\Core\Entity\EntityStorageException: !message in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionDelete() (line 512 of /docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php). [error] Cache rebuild complete. [ok] Finished performing updates. 
5
  • can you post the error messages? Commented May 8, 2018 at 16:40
  • @awm I've updated my original with the error messages I'm getting. Commented May 8, 2018 at 17:04
  • 1
    Fields are purged by cron, not by drush entup, see drupal.stackexchange.com/questions/253055/… Commented May 8, 2018 at 18:32
  • @4k4 if the field has data and entup attempts to remove them, then the field won't be removed. is that correct? fields have to be removed manually or via update hooks. Commented May 8, 2018 at 18:45
  • 2
    Look at the error message of drush entup: "The field lingotek_translation_source has already been deleted and it is in the process of being purged." So you probably need to run cron. Commented May 8, 2018 at 18:54

1 Answer 1

1

Update: it seems that you need to run cron to complete the field purging process drupal goes through.

Also you may be getting some errors when the fields you are deleting have data in them . entup does not attemp to drop fields with data in them and you have to do it yourself. You have 2 options:

  1. Go to each field in the content type and delete them manually.
  2. Write an update hook that delete the fields before you run entup. In other words, you run drush updb then you run drush entup provided you have implemented an update hook that deletes the fields. Something like this (code not tested):

    function my_module_update_8001() { $entity_type = 'node'; // or user or wherever the field appears $bundle_name = "article"; // or whereever the field appears $field_machine_names = array('field_one', 'field_two'); foreach($field_machine_names as $field_machine_name) { $field = \Drupal::entityManager()->getStorage('field_config')->load($entity_type.$bundle_name.$field_machine_name); $field->delete(); } } 

In addition, make sure that you run cron frequently because that's when drupal does garbage collection and deleted field data get purged.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.