--- menu_per_role.install.orig	2009-03-17 23:54:50.000000000 -0600
+++ menu_per_role.install	2009-03-20 15:43:55.000000000 -0600
@@ -60,10 +60,6 @@ function menu_per_role_update_6000() {
 
   db_query('DELETE FROM menu_per_role');
 
-  // delete old schema
-  db_drop_field($ret, 'menu_per_role', 'mid');
-  db_drop_field($ret, 'menu_per_role', 'rid');
-
   // create new fields right there
   db_add_field($ret, 'menu_per_role', 'mlid', array(
     'description' => t('The menu identifier.'),
@@ -78,6 +74,11 @@ function menu_per_role_update_6000() {
     'not null' => TRUE,
   ));
 
+  // delete old schema fields and set new primary key
+  db_drop_field($ret, 'menu_per_role', 'mid');
+  db_drop_field($ret, 'menu_per_role', 'rid');
+  db_add_primary_key($ret, 'menu_per_role', array('mlid'));
+
   // save the old data in the new table
   foreach ($mid as $key => $value) {
     if (count($value) > 0) {
