Inserted Development 6.x-1.x-dev and it cause Database update failure.
Problem went away with Release 6.x-1.0.

Within Status Report (/admin/reports/status):

The following queries were executed
menu_per_role module
Update #6000

* Failed: ALTER TABLE {menu_per_role} DROP mid
* Failed: ALTER TABLE {menu_per_role} DROP rid
* Failed: ALTER TABLE {menu_per_role} ADD `mlid` INT unsigned NOT NULL DEFAULT 0
* Failed: ALTER TABLE {menu_per_role} ADD `rids` TEXT DEFAULT NULL
* ALTER TABLE {menu_per_role} CHANGE rids `rids` TEXT NOT NULL

* user warning: Unknown column 'mid' in 'field list' query: SELECT mid, rid FROM menu_per_role WHERE mid IS NOT NULL in /home/dev/sites/svn_pm_site_repo/site/web/drupal/sites/all/modules/menu_per_role/menu_per_role.install on line 56.
* user warning: Can't DROP 'mid'; check that column/key exists query: ALTER TABLE menu_per_role DROP mid in /home/dev/sites/svn_pm_site_repo/site/web/drupal/includes/database.mysql-common.inc on line 322.
* user warning: Can't DROP 'rid'; check that column/key exists query: ALTER TABLE menu_per_role DROP rid in /home/dev/sites/svn_pm_site_repo/site/web/drupal/includes/database.mysql-common.inc on line 322.
* user warning: Duplicate column name 'mlid' query: ALTER TABLE menu_per_role ADD `mlid` INT unsigned NOT NULL DEFAULT 0 in /home/dev/sites/svn_pm_site_repo/site/web/drupal/includes/database.mysql-common.inc on line 298.
* user warning: Duplicate column name 'rids' query: ALTER TABLE menu_per_role ADD `rids` TEXT DEFAULT NULL in /home/dev/sites/svn_pm_site_repo/site/web/drupal/includes/database.mysql-common.inc on line 298.
* warning: Invalid argument supplied for foreach() in /home/dev/sites/svn_pm_site_repo/site/web/drupal/sites/all/modules/menu_per_role/menu_per_role.install on line 82.

Jeff in Seattle

Comments

Hey Jeff in Seattle,

That would be because I may actually need to test whether you already have the new tables or not!

And I thought I was dropping the old columns after I created the new ones...

If you were not running v5.x and switching to 6.x you do not need that conversion anyway.

Thank you for the report!
Alexis Wilke

Hi

I have only been running with Drupal 6.1.

Jeff in Seattle

Okay, so you can use either version and ignore the Update complaints. 8-)

I'll close this issue once I have a fix to this problem.

Thank you.
Alexis

Status:Active» Fixed

Problem went away with Release 6.x-1.0.

Can confirm that the module works as promised, no error messages when running update.php. Setting status to "fixed".

Title:Menu pre Role causes Database update failureMenu per Role causes Database update failure
Version:6.x-1.x-dev» 6.x-1.1
Status:Fixed» Active

I'm getting the same errors when running update.php after last upgrade of the module to the v6.x-1.1. I'm running Drupal 6.10.

In my case (I've never ran v5.x), {menu_per_role} table already hasn't neither "mir" nor "rid" columns.
Moreover, mlid is int(10) unsigned NOT NULL default '0' and rids is text NOT NULL.

We don't need to do anything. Right?

Status:Active» Fixed

Okay! Got it!

The function in the update would check for a column name that was wrong and thus the code would believe you had the old table.

Looking at the code, it looks like the data would be deleted by this statement:

<?php
db_query
('DELETE FROM menu_per_role');
?>

So if you did not have a backup (or just a couple of links to hide) then you just lost your data... Ack!

I'm generating a newer version that fixes the problem.

Sorry about that!
Alexis Wilke

Status:Fixed» Closed (fixed)

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

Version:6.x-1.1» 6.x-1.2
Status:Closed (fixed)» Needs work

I just upgraded from 5.18 to 6.12 and got the following output from update.php:

* user warning: You can't delete all columns with ALTER TABLE; use DROP TABLE instead query: ALTER TABLE menu_per_role DROP rid in /backup/clients/wjgsa/wjgsa/drupal-6.12/includes/database.mysql-common.inc on line 322.
* user warning: Duplicate entry '0' for key 'PRIMARY' query: INSERT INTO menu_per_role (mlid, rids) VALUES (69, '3') in /backup/clients/wjgsa/wjgsa/drupal-6.12/sites/all/modules/menu_per_role/menu_per_role.install on line 85.
* user warning: Duplicate entry '0' for key 'PRIMARY' query: INSERT INTO menu_per_role (mlid, rids) VALUES (101, '3,4') in /backup/clients/wjgsa/wjgsa/drupal-6.12/sites/all/modules/menu_per_role/menu_per_role.install on line 85.
* user warning: Duplicate entry '0' for key 'PRIMARY' query: INSERT INTO menu_per_role (mlid, rids) VALUES (140, '3,4') in /backup/clients/wjgsa/wjgsa/drupal-6.12/sites/all/modules/menu_per_role/menu_per_role.install on line 85.

-- and --

The following queries were executed
menu_per_role module
Update #6000

* ALTER TABLE {menu_per_role} DROP mid
* Failed: ALTER TABLE {menu_per_role} DROP rid
* ALTER TABLE {menu_per_role} ADD `mlid` INT unsigned NOT NULL DEFAULT 0
* ALTER TABLE {menu_per_role} ADD `rids` TEXT DEFAULT NULL
* ALTER TABLE {menu_per_role} CHANGE rids `rids` TEXT NOT NULL
* INSERT INTO {menu_per_role} (mlid, rids) VALUES (9, '3')
* Failed: INSERT INTO {menu_per_role} (mlid, rids) VALUES (69, '3')
* Failed: INSERT INTO {menu_per_role} (mlid, rids) VALUES (101, '3,4')
* Failed: INSERT INTO {menu_per_role} (mlid, rids) VALUES (140, '3,4')

Status:Needs work» Needs review

rechrem,

Could you test with the -dev version instead? I don't think I published it since I made this fix.

Sorry about the trouble!

Thank you.
Alexis

Yes. I was doing this on a backup site to test the upgrade, so will use the -dev version and report my findings. This won't happen until (at least) May 24, though...

richrem,

You may want to reset the backup and try again on the backup first. Although the update is done in a transaction so it should not have changed the database. In other words, uninstalling and trying again with the same server should generate the errors again (with 1.2) or not (with -dev).

Thank you.
Alexis

The -dev version worked for me - e.g. no warnings or errors. Unfortunately, I have other unrelated issues I'm trying to resolve at the moment...

Richrem,

Thank you for posting. I will make the -dev version 1.3

Alexis Wilke

Status:Needs review» Fixed

Should mark this as fixed too 8-)

Status:Fixed» Closed (fixed)

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