You are here

function system_update_6044 in Drupal 6

RC1 to RC2 index cleanup.

Related topics

File

modules/system/system.install, line 2514

Code

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;
}