diff --git a/modules/system/system.install b/modules/system/system.install index f274534425d2cbac3e1415e2e334d315ec1c3563..6f038dcfe5159274809e2e28e4d8811167e3ebda 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2312,7 +2312,7 @@ function system_update_6043() { db_drop_index($ret, 'node', 'status'); db_drop_unique_key($ret, 'node', 'nid_vid'); // Improve user module indices. - db_add_unique_key($ret, 'users', 'mail', array('mail')); + db_add_index($ret, 'users', 'mail', array('mail')); db_add_index($ret, 'users_roles', 'rid', array('rid')); // Optional modules - need to check if the tables exist. @@ -2355,7 +2355,7 @@ function system_update_6043() { // Alter taxonomy module's tables. if (db_table_exists('term_data')) { db_drop_index($ret, 'term_data', 'vid'); - db_add_unique_key($ret, 'term_data', 'vid_name', array('vid', 'name')); + db_add_index($ret, 'term_data', 'vid_name', array('vid', 'name')); db_add_index($ret, 'term_data', 'taxonomy_tree', array('vid', 'weight', 'name')); } if (db_table_exists('term_node')) { @@ -2369,7 +2369,7 @@ function system_update_6043() { } if (db_table_exists('term_synonym')) { db_drop_index($ret, 'term_synonym', 'name'); - db_add_unique_key($ret, 'term_synonym', 'name_tid', array('name', 'tid')); + db_add_index($ret, 'term_synonym', 'name_tid', array('name', 'tid')); } if (db_table_exists('vocabulary')) { db_add_index($ret, 'vocabulary', 'list', array('weight', 'name')); @@ -2379,6 +2379,41 @@ function system_update_6043() { db_add_primary_key($ret, 'vocabulary_node_types', array('type', 'vid')); db_add_index($ret, 'vocabulary_node_types', 'vid', array('vid')); } + // If we updated in RC1 or before ensure we don't update twice. + variable_set('system_update_6043_RC2', TRUE); + + return $ret; +} + +/** + * RC1 to RC2 index cleanup. + */ +function system_update_6044() { + $ret = array(); + + // Delete invalid entries in {term_node} after system_update_6001. + $ret[] = update_sql("DELETE FROM {term_node} WHERE vid = 0"); + + // Only execute the rest of this function if 6043 was run in RC1 or before. + if (variable_get('system_update_6043_RC2', FALSE)) { + variable_del('system_update_6043_RC2'); + return $ret; + } + + // User module indices. + db_drop_unique_key($ret, 'users', 'mail'); + db_add_index($ret, 'users', 'mail', array('mail')); + + // Optional modules - need to check if the tables exist. + // Alter taxonomy module's tables. + if (db_table_exists('term_data')) { + db_drop_unique_key($ret, 'term_data', 'vid_name'); + db_add_index($ret, 'term_data', 'vid_name', array('vid', 'name')); + } + if (db_table_exists('term_synonym')) { + db_drop_unique_key($ret, 'term_synonym', 'name_tid', array('name', 'tid')); + db_add_index($ret, 'term_synonym', 'name_tid', array('name', 'tid')); + } return $ret; } diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install index 18ee82e1fd0dbf605ad6d1d7003861daf7dd9900..fa17ede78acce59fa3300f29a2609883bbd539f9 100644 --- a/modules/taxonomy/taxonomy.install +++ b/modules/taxonomy/taxonomy.install @@ -43,10 +43,10 @@ function taxonomy_schema() { ), ), 'primary key' => array('tid'), - 'unique keys' => array( + 'indexes' => array( + 'taxonomy_tree' => array('vid', 'weight', 'name'), 'vid_name' => array('vid', 'name'), ), - 'indexes' => array('taxonomy_tree' => array('vid', 'weight', 'name')), ); $schema['term_hierarchy'] = array( @@ -160,11 +160,9 @@ function taxonomy_schema() { 'description' => t('The name of the synonym.'), ), ), - 'unique keys' => array( - 'name_tid' => array('name', 'tid'), - ), 'indexes' => array( 'tid' => array('tid'), + 'name_tid' => array('name', 'tid'), ), 'primary key' => array('tsid'), ); diff --git a/modules/user/user.install b/modules/user/user.install index 8bdcfc963ff9ea3326c0d4876cd08ccb8b0671a9..6df206e02e911a1875f76fcfb0c758436dfd95c9 100644 --- a/modules/user/user.install +++ b/modules/user/user.install @@ -252,11 +252,11 @@ function user_schema() { ), 'indexes' => array( 'access' => array('access'), - 'created' => array('created') + 'created' => array('created'), + 'mail' => array('mail'), ), 'unique keys' => array( 'name' => array('name'), - 'mail' => array('mail'), ), 'primary key' => array('uid'), );