When reverting a feature that contains a relation field, I get the following error. Please note that this is using an up-do-date repository, with update 7001 having run.
[jpathan@drupal-qa-jnl-web02 drupal-webroot]$ drush fr highwire -y
Do you really want to revert field? (y/n): y
WD php: DatabaseSchemaObjectExistsException: Cannot add index endpoints_entity_id to table field_data_endpoints: index [error]
already exists. in DatabaseSchema_mysql->addIndex() (line 443 of
/opt/sites/jnl-ajpheart-testing/drupal-webroot/includes/database/mysql/schema.inc).
Cannot modify header information - headers already sent by (output started at [warning]
/usr/share/pear/drush/includes/output.inc:38) bootstrap.inc:1440
DatabaseSchemaObjectExistsException: Cannot add index endpoints_entity_id to table field_data_endpoints: index already exists. in DatabaseSchema_mysql->addIndex() (line 443 of /opt/sites/jnl-ajpheart-testing/drupal-webroot/includes/database/mysql/schema.inc).
Drush command terminated abnormally due to an unrecoverable error. [error]
Under investigation, it appears that it is because the indexes in the database are in a different order than the indexes in the schema, resulting in field-api thinking the schema is out-of-date and tries to add the indexes, resulting in an error.
Comments
Comment #2
phayes commentedAttached is a patch that fixes this issue.
Comment #3
derhasi commentedThis seems to be a core bug: see #2003746: field_read_fields() omits indexes from hook_field_schema.
Comment #4
mikran commented@phayes does the core patch fix your problem?
Your patch is re-adding indexes the same way as the original update hook did so I fear that it might not even fix the real issue here.
Comment #5
possibriI'm also experiencing this issue, and the provided patch definitely doesn't work. Anybody have any idea how to fix this? If I can get pointed in the right direction I can probably figure it out, but I honestly don't even know where to begin. Thanks!
Comment #6
scuba_flyCombined with the core patch https://www.drupal.org/node/2003746#2 I got rid of this error.
Comment #7
possibriThanks @scuba_fly! I can confirm that implementing this with the core patch indeed solves the issue.
Comment #8
jfhovinne commentedI had the exact same issue, and also confirm #6.
Comment #9
mikran commentedpostponed until #2003746: field_read_fields() omits indexes from hook_field_schema lands