Skip to content

Instantly share code, notes, and snippets.

@steveoliver
Last active July 18, 2016 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveoliver/79bd59afb43e7c9c7cfa9a33b54a0bef to your computer and use it in GitHub Desktop.
Save steveoliver/79bd59afb43e7c9c7cfa9a33b54a0bef to your computer and use it in GitHub Desktop.
Field Collection database/uuid issue(s) (nested field collections), Drupal 8

database observations

  • field_collection_item__field_CHILDCOLLECTION_X tables exist for all child field collections EXCEPT the one without the UUID
  • field_collection_item__668c612c1b table exists for the child field collection under consideration (will call it field_CHILDCOLLECTION_Y). ... It has the same structure as the other tables with valid data for field instances.

configuration

  • field_collection config item 'field_CHILDCOLLECTION_Y' has null uuid value.

drupal behaviour

  • DELETE field_CHILDCOLLECTION_X1: OK.
  • DELETE field_CHILDCOLLECTION_X2: OK.
  • DELETE field_CHILDCOLLECTION_X3: OK.
  • DELETE field_CHILDCOLLECTION_Y: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'main.field_collection_item__field_CHILDCOLLECTION_Y' doesn't exist: SELECT `entity_id` FROM {field_collection_item__field_CHILDCOLLECTION_Y} WHERE `bundle` = 'field_PARENTCOLLECTION_X'; Array ( ) in field_collection_field_config_predelete() (line 95 of modules/contrib/field_collection/field_collection.module).
    • however, the data from the field_collection_item__668c612c1b table was deleted

solution

  • mysql: clone table field_collection_item__668c612c1b to field_collection_item__field_CHILDCOLLECTION_Y
  • drupal ui: delete the field_CHILDCOLLECTION_Y field collection.
  • drupal ui: delete the field_collection_item__field_CHILDCOLLECTION_Y table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment