--- user_badges.install.orig	2009-02-22 18:31:38.000000000 +1100
+++ user_badges.install	2009-02-22 18:39:08.000000000 +1100
@@ -67,93 +67,84 @@
   );
   $schema['user_badges_product'] = array(
     'description' => 'Holds the user badge images',
     'fields' => array(
       'bid' => array(
         'description' => t('Original badge ID'),
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'default' => 0
       ),
       'nid' => array(
         'description' => t('Node ID'),
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'default' => 0,
       ),
     ),
     'primary key' => array('bid', 'nid'),
-    'indexes' => array(
-      'bid_nid' => array('bid', 'nid'),
-      'nid_bid' => array('nid', 'bid'),
-    ),
   );
   $schema['user_badges_roles'] = array(
     'description' => 'Holds the user badge images',
     'fields' => array(
       'rid' => array(
         'description' => t('Original role ID'),
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
       ),
       'bid' => array(
         'description' => t('Original badge ID'),
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
       ),
     ),
     'primary key' => array('bid', 'rid'),
-    'indexes' => array(
-      'bid_nid' => array('bid', 'rid'),
-      'nid_bid' => array('rid', 'bid'),
-    ),
   );
   $schema['user_badges_user'] = array(
     'description' => 'Holds the user badge images',
     'fields' => array(
       'uid' => array(
         'description' => t('Original user ID'),
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
       ),
       'bid' => array(
         'description' => t('Original badge ID'),
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
       ),
       'type' => array(
         'description' => t('Badge Type'),
         'type' => 'varchar',
         'length' => 20,
         'not null' => TRUE,
         'default' => '',
       ),
     ),
     'primary key' => array('bid', 'uid', 'type'),
     'indexes' => array(
-      'bid_uid_type' => array('bid', 'uid', 'type'),
       'uid_bid' => array('uid', 'bid'),
       'type' => array('type'),
     ),
   );
   
   return $schema;
 }
 
 
 /**
  * Implementation of hook_install()
  */
 function user_badges_install() {
   drupal_install_schema('user_badges');
 }
 
 
 /**
  * Implementation of hook_uninstall()
  */
@@ -177,20 +168,31 @@
 
 /**
  * Implementation of hook_update_N()
  * new DB structure
  */
 function user_badges_update_6001() {
   $ret = array();
   db_drop_primary_key($ret, 'user_badges_user');
   db_add_primary_key($ret, 'user_badges_user', array('bid', 'uid', 'type'));
   db_add_index($ret, 'user_badges_user', 'type', array('type'));
   return $ret;
 }
 
 
 function user_badges_update_6100() {
   $ret = array();
   db_add_field($ret, 'user_badges_badges', 'href', 
     array('type' => 'varchar', 'length' => 80, 'not null' => FALSE, 'default' => ''));
   return $ret;
 }
+
+
+function user_badges_update_6101() {
+  $ret = array();
+  db_drop_index($ret, 'user_badges_product', 'bid_nid');
+  db_drop_index($ret, 'user_badges_product', 'nid_bid');
+  db_drop_index($ret, 'user_badges_roles', 'bid_nid');
+  db_drop_index($ret, 'user_badges_roles', 'nid_bid');
+  db_drop_index($ret, 'user_badges_user', 'bid_uid_type');
+  return $ret;
+}
