summaryrefslogtreecommitdiff
path: root/modules/system/system.install
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2008-01-08 07:46:41 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2008-01-08 07:46:41 +0000
commit0ab0b1d65f494dbef7f2152b789c721711000001 (patch)
tree81b5fe352595ea45d9a979d8e5bf9307193e85ed /modules/system/system.install
parent68a730c7955dc7b7f1372a8bf574b7a167102a80 (diff)
downloadbrdo-0ab0b1d65f494dbef7f2152b789c721711000001.tar.gz
brdo-0ab0b1d65f494dbef7f2152b789c721711000001.tar.bz2
#164532 follow up by pwolanin, David Strauss, catch and myself, testing also by hswong3i: some indexes added before Drupal 6 RC1 were too unique, and our code did not back them, so we should not add those indexes
Diffstat (limited to 'modules/system/system.install')
-rw-r--r--modules/system/system.install41
1 files changed, 38 insertions, 3 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index f27453442..6f038dcfe 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;
}