Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When trying to edit a field collection I get the error:
Attempt to update field Fieldname failed: Cannot add index field_fieldname_revision_id to table field_data_field_fieldname: index already exists..
Comments
Comment #1
nostop8 CreditAttribution: nostop8 commentedI confirm same bug (using field collection 7.x-1.x). I have no idea why and when it happen, but my field collection instances does not have indexes inside data column. That's why it throws error on field collection save.
I made a small workaround which will allow you to save your field collection. The only place I could add indexes was to field data was hook_field_update_forbid (from its name it does not seem that it serves for these needs, but another hook hook_field_read_field which is there too does not allow to change the data... strange behavior from drupal core... :( ).
Anyway, here's what I made:
You will need this only once, to save your collection field. Then you won't need it anymore for this specific field collection.
This is just a workaround. Guys from Field Collection team need to find what's the problem if this strange behavior. Maybe it has something to do with the nested field collections? I do not have any idea and do not have time to test it. But the issue exists!!
Comment #2
tuccio CreditAttribution: tuccio commentedHi thank you. The issue first seems to occurs when revisions are enabled, but even after disabling revisions then the issue persists.
Comment #3
nostop8 CreditAttribution: nostop8 commentedComment #4
tuccio CreditAttribution: tuccio commentedComment #5
tuccio CreditAttribution: tuccio commentedIs this a related issue? https://drupal.org/node/2141781
Comment #6
Dane Powell CreditAttribution: Dane Powell commentedYes, I think this is a dupe of #2141781: Existing index issue with revision_id index