You are here

function votingapi_update_5 in Voting API 6.2

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

Fixed index definition, corrected table prefixes.

File

./votingapi.install, line 152
Installation file for VotingAPI module.

Code

function votingapi_update_5() {
  $ret = array();
  db_add_index($ret, '{votingapi_vote}', 'content', array(
    'content_type',
    'content_id',
  ));
  db_add_index($ret, '{votingapi_cache}', 'content', array(
    'content_type',
    'content_id',
  ));
  db_drop_index($ret, '{votingapi_vote}', 'content_type');
  db_drop_index($ret, '{votingapi_vote}', 'content_id');
  db_drop_index($ret, '{votingapi_cache}', 'content_type');
  db_drop_index($ret, '{votingapi_cache}', 'content_id');
  db_rename_table($ret, 'votingapi_action_condition', '{votingapi_action_condition}');
  db_rename_table($ret, 'votingapi_action', '{votingapi_action}');
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $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;
}