The same site as previous issue (5088 - abh) fails on

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'campagnes' for key 'machine_name'                                                                                            [error]
Performed update: menu_position_update_7103                                                                                                                                                         [ok]

Second attempt at drush updatedb:

Cannot add field menu_position_rules.machine_name: field already exists.                                                                                                                            [error]
Performed update: menu_position_update_7103                                                                                                                                                         [ok]

disable + uninstall of menu_position, then re-enabling after update makes the update "work", but of course is likely to result in some data loss (not seeing it immediately on the updated site though) - I needed to explicitly rebuild the permissions afterwards to make the site appear correctly.

Comments

bdeclerc created an issue. See original summary.

stefan.r’s picture

Status: Active » Closed (won't fix)

Reported an issue in #2742309: menu_position_update_7103() fails if menu position rules with the same title exist.

This happens only when menu position rules with the same title exist, such as when using the same rule, for an NL menu and for a FR menu.

I don't think this is worth patching, instead we can run the following query on all sites to identify which ones will have a problem with the update hook:

select admin_title, count(*) as count from menu_position_rules group by admin_title having count > 1;

I suspect very few websites will be affected, so we can rather do a manual workaround by updating the admin_title values where needed, ensuring we don't have any duplicates. So on this site, we could change it to "Campagnes NL" and "Campagnes FR".

bdeclerc’s picture

Status: Closed (won't fix) » Active

Hmm, apparently this is more complicated - see https://www.drupal.org/node/2625504 for a patch which fixes the hook_update that causes this issue. Can we include the patch or get them to release a 1.3 including the fix?

stefan.r’s picture

I don't see how it's more complicated? #2 should fix the issue. The patch in the linked issue only solves the problem for items with underscore-only machine names.

stefan.r’s picture

So basically, the patch in the linked issue wouldn't have solved the issue we had in ABH... and if on any site we had the issue, the query would catch it.

It looks like the query should be this, however:

select machine_name, count(*) as count from menu_position_rules group by machine_name having count > 1;

bdeclerc’s picture

Allright, I'll check with Stéphane Leroy so we can see how often this issue exists.