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.
The update hook to update the permissions is using an invalid value for the N in the function name.
In some installs the update would cause this mysql error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3-administer field collections' for key 'PRIMARY' because the update doesn't get registered properly as an update to the initial install
field_collection_7000 should be field_collection_7001 and then increase from that point.
the 7000 is reserved for the initial 7.x install.
Comment | File | Size | Author |
---|---|---|---|
field_collection_install_N_fix.patch | 552 bytes | cntlscrut | |
Comments
Comment #1
kmare CreditAttribution: kmare commentedHello,
with the latest dev from 2012-Jan-11, I was getting that error too. cntlscrut, using your patch, nothing really changed as I'm still getting the very same error. Any ways I could help to track that error down?
Thank you in advance.
Comment #2
Michael-IDA CreditAttribution: Michael-IDA commentedVersion : 7.x-1.0-beta3
After patch:
Really looks like it's an SQL bug, not the function name being wrong.
Pretty much messes up /admin/reports/updates as well. "$ drush pm-update" seems okay though.
Best,
Sam
Comment #3
tim.plunkettA patch would be nice. I think we might need to write a new 7001 function that does the same as 7000 but only if that one wasn't run.
Comment #4
jantoine CreditAttribution: jantoine commentedThis error is not due to the update function being named incorrectly, although that is a bug and should be fixed!
This error is occurring because before the update function is run, Drupal has already recognized that the Field Collection module has a new permission 'administer field collections' and has assigned that permission to the administrator role! If the update function is run after this takes place, the update attempts to create a duplicate entry for the administrator role and this new permission. This update fails because the primary key consists of the rid and permission fields.
I think a proper solution could be to delete any permissions associated with the administrator role before running this update query.
Comment #5
_redfog CreditAttribution: _redfog commentedI confirmed by unchecking administrator's permissions for field collection module, then apply update, worked for me.
See #4
Comment #6
jmuzz CreditAttribution: jmuzz commented