When updating from Drupal 5.16 to 6.10, and using MySQL, the database update fails with this error:

# user warning: You can't delete all columns with ALTER TABLE; use DROP TABLE instead query: ALTER TABLE menu_per_role DROP rid in /home/userid/htdocs/dp6devel/includes/database.mysql-common.inc on line 322.

... followed by a sequence of these errors as it tries to write to the modified table:

# user warning: Duplicate entry '0' for key 1 query: INSERT INTO menu_per_role (mlid, rids) VALUES (9, '2') in /home/userid/htdocs/dp6devel/sites/all/modules/menu_per_role/menu_per_role.install on line 85.

In menu_per_role_update_6000(), it looks like you'd want to either delete the two deprecated fields *after* creating the new fields, or simply drop and recreate the table.

Here's a patch that handles the D5->D6 migration -- at least, it yields a table that matches the schema definition. I don't know if this affects anything else, though -- but I hope this helps.


menu_per_role.install.patch909 bytesjshuster@drupal.org
Members fund testing for the Drupal project. Drupal Association Learn more


AlexisWilke’s picture

Status: Needs review » Fixed


I applied your fix in the CVS.

PostgreSQL is fine with deleting all the columns... 8-)

Thank you.

jshuster@drupal.org’s picture


My pleasure! Thanks for a most handy module!

- JShuster

Status: Fixed » Closed (fixed)

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