When I've tried to updgrade from 1.11-beta9 to 1.11-beta 10, I get the following error from the module openchurch_defaults:

Update #7005
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'openchurch_theme-menu_block-1' for key 'tmd': INSERT INTO {block} (module, delta, theme, status, weight, region, custom, visibility, pages, title) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => menu_block [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => openchurch_theme [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => -1 [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => 0 [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => ) in drupal_write_record() (line 7136 of /Applications/MAMP/htdocs/drupal_cathedral/includes/common.inc).

All of the other modules update properly, but this one gives me this error over and over. I've tried flushing my caches, but it doesn't change anything. I can't seem to decipher where the problem actually lies. Any help would be appreciated!

CommentFileSizeAuthor
Screen Shot 2013-05-21 at 12.13.53 AM.png127.35 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drupalninja99’s picture

Status: Active » Needs work

Darn, I didn't get this error when I upgraded from beta9 to 10. Okay so what probably happened is that you already had menu block installed and OC made an incorrect assumption that it wasn't already installed. Is that the case?

drupalninja99’s picture

In profiles/openchurch/modules/features/openchurch_defaults/openchurch_defaults.updates.inc go to line 250 and comment out the line "_openchurch_defaults_add_block_title(1, '', 'menu_block');" and see if that fixes the issue. I could do a patch, although it will need to create quite a bit of logic to get the right menu to appear for the mobile menu.

Anonymous’s picture

Thanks so much for your response. I tried what you suggest.

Commenting out line 250 prevents the error message while upgrading. But then another problem arises - the resulting site doesn't have a mobile menu at all (when I resize the browser window, the menu disappears and isn't replaced with the drop-down menu, nor does one appear when I refresh at that width). Suggestions?

drupalninja99’s picture

Okay, so I think I have a fix for this. I am adding a little bit of logic that will 'detect' the menu_block delta and adjust accordingly in the update hook. So what should happen on a new install is that nothing changes, OpenChurch will assume menu block is delta/instance "1". For upgrades it looks for the highest delta and adds 1 to it. It then will use that in the various variable_sets & gets that reference the mobile menu block.

drupalninja99’s picture

Status: Needs work » Needs review

I have pushed this fix to dev. Hopefully you are trying this out on a test instance. When dev gets packaged later today I would like you to retry the upgrade. Or at the very least you need to openchurch_defaults 7005 update and clear caches afterwards.

I have done local tests from a beta9 install that had main_menu installed with 1 previous menu block. This is now working for me. I had to make a couple of changes to the update hook and a couple of small changes to the openchurch theme but I was able to see the mobile menu using block delta "2" instead of 1.

Let me know if this works for you.

Anonymous’s picture

Yes, I was trying it out on a test install.

Thanks so much - the most recent dev package worked just fine - the install went without a hitch, and the mobile menu appears just fine. Thanks so much for your help with this!

drupalninja99’s picture

Awesome!

drupalninja99’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.