You are here

function votingapi_update_5 in Voting API 6

Same name and namespace in other branches
  1. 5 votingapi.install \votingapi_update_5()
  2. 6.2 votingapi.install \votingapi_update_5()

Fixed index definition, corrected table prefixes.

File

./votingapi.install, line 107

Code

function votingapi_update_5() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {votingapi_vote} ADD INDEX content (content_type, content_id);");
      $ret[] = update_sql("ALTER TABLE {votingapi_cache} ADD INDEX content (content_type, content_id);");
      $ret[] = update_sql("ALTER TABLE {votingapi_vote} DROP INDEX content_type;");
      $ret[] = update_sql("ALTER TABLE {votingapi_vote} DROP INDEX content_id;");
      $ret[] = update_sql("ALTER TABLE {votingapi_cache} DROP INDEX content_type;");
      $ret[] = update_sql("ALTER TABLE {votingapi_cache} DROP INDEX content_id;");
      $ret[] = update_sql("RENAME TABLE votingapi_action_condition TO {votingapi_action_condition};");
      $ret[] = update_sql("RENAME TABLE votingapi_action TO {votingapi_action};");
      $ret[] = update_sql("UPDATE {sequences} SET name = '{votingapi_cache}' WHERE name = 'votingapi_cache';");
      $ret[] = update_sql("UPDATE {sequences} SET name = '{votingapi_vote}' WHERE name = 'votingapi_vote';");
      break;
  }
  return $ret;
}