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.
Just ran the upgrade from 7.x-1.0-rc2 to the new full 7.x-1.0 and found all field_groups from all content types wiped out. I saw an earlier ticket marked as fixed for this but thought it best to start a new ticket since this is related to the new full release version.
Comment | File | Size | Author |
---|---|---|---|
#28 | field_group-rebuild_schema_on_update-1169146-28.patch | 480 bytes | Nephele |
#15 | field_group_install_diff-1169146-15.patch | 611 bytes | ankur |
Comments
Comment #1
boringtao CreditAttribution: boringtao commentedgot the same problems.
Comment #2
sachbearbeiter CreditAttribution: sachbearbeiter commentedthe same
Comment #3
Stalski CreditAttribution: Stalski commentedDid you run update.php?
(7001 and ) 7002 should have fixed this problem. Thx in advance.
Comment #4
Stalski CreditAttribution: Stalski commentedHey all.
For people who did not have the field group depending on ctools before, some bigger work is needed to save time. See #1095002: Upgrading removes all existing field groups. (http://drupal.org/node/1095002#comment-4241778).
For the majority coming from rc2, the update hook 7002 should be the only thing needed. However, as some problems were logged here, you might consider setting the heartbeat entry in the system table to a lower version so 7001 and 7002 can be run. This should create identifiers (new field in the database) for each field group row.
Comment #5
Stalski CreditAttribution: Stalski commentedbumping this to get feedback as this is very critical and could even mean a new release is needed.
Comment #6
andreicio CreditAttribution: andreicio commentedFeedback:
I upgraded from rc2 to 1.0.
I ran update.php, but can't tell you what updates were applied or how many had to do with field_group.
I checked field_group table: `identifier` exists, all values are empty.
Set schema_version=7001 in the system table, re-ran update.php, 7002 was applied, succesfully generated identifiers.
All OK.
If there are 2 pending updates for a module, do they all run in sequence, or only the first one? Because in my case it's clear that the identifiers generation didn't work.
Comment #7
Stalski CreditAttribution: Stalski commentedThey do apply both, however, I detected a problem where I once at the beginning had an update hook called 7001, however it did make sense so removed it. Later on, I did add the first update hooks and it's possible people had 7001 already ran :(
Sorry for that. I do know that it's the identifiers that go wrong somehow (or the update hook creating them). I am investigating this a little further.
Thank you very much for the feedback! It's the answer I hoped for. (with a solution)
Comment #8
bryancasler CreditAttribution: bryancasler commentedI can confirm that the solution in #6 works
Comment #9
molave CreditAttribution: molave commentedsubscribe
Comment #10
Stalski CreditAttribution: Stalski commented@molave: It should be fixed as the issue reads, however if you do still have problems, please provide steps for us to reproduce it.
Comment #11
jeffrey.dalton CreditAttribution: jeffrey.dalton commentedJust an update... I took a fresh copy of our dev site and ran this again locally and it worked fine. Then I ran it on the dev site and it failed as described in #6 at which point I followed the steps in #6 and fixed the issue. I would say there is definitely still something amiss in the update script.
Thanks to andreicio for posting the fix steps
Comment #12
molave CreditAttribution: molave commented@Stalski - Thanks, I appreciate the prompt reply. My issue is slightly different and only minor at this point (those warning messages that start with "Notice: Undefined property: stdClass::$identifier..."). I am already subscribed to the correct thread, but am subscribing anyway to related issues, too, as a precaution. Cheers...
Comment #13
scott.whittaker CreditAttribution: scott.whittaker commentedWhoa, same issue here. The fix in #6 did seem to work, except that afterwards fieldsets inside vertical tabs are no longer rendered. I'm not referring to the CSS bug I identified earlier (http://drupal.org/node/1127988) - this time the fieldset markup is not even rendered into the page any more.
Have reverted back to rc2.
Comment #14
Mamouri CreditAttribution: Mamouri commentedI had the same problem, and solution #6 works fine for me too.
Comment #15
ankur CreditAttribution: ankur commentedFound the culprit.
function field_group_schema()
in field_group.install incorrectly declares "identifier" as the key to ctools. It should be "id".The attached patch (followed by a clearing of the cache) fixed the problem for me.
-Ankur
Comment #16
Stalski CreditAttribution: Stalski commentedWell actually ctools suggest the unique string name and that is identifier. What I should do, i guess, is get rid of the primary key 'id' as it is a auto-increment integer that is not of real use here.
Comment #17
alex_ustinov CreditAttribution: alex_ustinov commentedSolution #6 worked for me, thank you! You saved my day - have so many field groups on our site.
Comment #18
scottrouse CreditAttribution: scottrouse commentedNice. #6 worked perfectly for me. I was looking at quite a bit of work to rebuild all of those field groups. Thanks!
Comment #19
dboulet CreditAttribution: dboulet commentedThanks for the pointer in #6, worked for me.
Comment #20
Stalski CreditAttribution: Stalski commentedHey all. the problem is that the update hook 7001 and 7002 will fix the problem. Appearantly there are still people who have already ran that function without having the identifiers.
I don't know for all cases what's the cause, but I'll create a 7003 update hook that also will invoke this identifier function. It is a reasonably harmless function that only recreates the identifiers. I really hope this problem is finally fixed for everyone.
Comment #21
astra CreditAttribution: astra commentedI got the same problem and want to try this way of #6. But I don't know What's the meaning for:
How to do it? Anyone can help?
Thanks!
Comment #22
dboulet CreditAttribution: dboulet commentedHi astra, try instead to upgrade to the latest dev release and make sure to run update.php, should fix the problem.
Comment #23
astra CreditAttribution: astra commentedIt works now with the latest dev release. Thnaks!
Comment #24
Stalski CreditAttribution: Stalski commentedComment #25
Agileware CreditAttribution: Agileware commentedUsing 7.x-1.0-rc2 and upgrading to 7.x-1.1. All fieldgroups deleted upon running update.php.
Comment #26
nils.destoop CreditAttribution: nils.destoop commentedWhen you check your field_group table? Are the identifiers filled in?
If not, update hook 7002 or 7003 did not ran. If you can't select this update anymore in update.php, you can manually run it by calling '_field_group_recreate_identifiers();'
Comment #27
nils.destoop CreditAttribution: nils.destoop commentedComment #28
Nephele CreditAttribution: Nephele commentedUnfortunately, this bug does still not appear to be truly fixed. I'm upgrading from 7.x-1.0-rc1 to 7.x-1.1, and still getting this problem -- field groups deleted, 'identifier' column in field_group table is empty, etc. Because the workaround in #6 works, I've downgraded the priority, but the fact is that the update code is still broken.
Furthermore, I subsequently retried the upgrade with the 7.x-1.x-dev code.. Not only did the identifiers fail to get created, but in addition 7.x-1.x-dev gives a nasty runtime error on the 7004 update:
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'identifier': ALTER TABLE {field_group} ADD UNIQUE KEY `identifier` (`identifier`); Array ( ) in db_add_unique_key() (line 2883 of drupal7/includes/database/database.inc).
I was going to start a separate issue for this PDOException, but it turns out it's caused by the same underlying problem -- and more importantly is fixed by the same patch.When I started testing the update with some debugging, I confirmed that during the original update, update_7001, update_7002, and update_7003 are all being called; _field_group_recreate_identifiers() is being called three separate times during the single update. So the problem is not that the updates are being skipped; the "fix" in #20 did not accomplish anything.
The actual problem is that after calling db_add_field() in update_7001, drupal's cached schema is never updated. Arguably, there's a core problem here -- either a bug or documentation failure (EDIT: #1617006: drupal_write_record() should say NOT to use it during hook_update_N added documentation stating that drupal_write_record() should not be used during update functions). Nevertheless, as far as current drupal code is concerned, the field_group table does not yet contain an identifier column -- and calling _field_group_recreate_identifiers a hundred times won't fix this problem. Instead, the schema has to be rebuilt.
The attached patch takes care of this. Based on my tests, update_7002 and update_7003 can also be eliminated now that the real source of the problem has been fixed, but I've left in them in place for now. The patch was rolled and tested on 7.x-1.x-dev, but it can also be applied to 7.x-1.1 if there are other people who need the fix but don't want to install dev code on their production site.
Comment #29
nils.destoop CreditAttribution: nils.destoop commentedA little late, but this one is now committed. Nice catch