You are here

function votingapi_update_3 in Voting API 5

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

Value fields changed to signed floats.

File

./votingapi.install, line 99

Code

function votingapi_update_3() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {votingapi_cache} CHANGE value_type value_type varchar(20) NOT NULL");
      $ret[] = update_sql("ALTER TABLE {votingapi_vote} CHANGE value_type value_type varchar(20) NOT NULL");
      $ret[] = update_sql("ALTER TABLE {votingapi_cache} ADD INDEX (content_type)");
      $ret[] = update_sql("ALTER TABLE {votingapi_cache} ADD INDEX (content_id)");
      $ret[] = update_sql("ALTER TABLE {votingapi_vote} ADD INDEX (content_type)");
      $ret[] = update_sql("ALTER TABLE {votingapi_vote} ADD INDEX (content_id)");
      $ret[] = db_query("UPDATE {votingapi_cache} SET value_type = 'percent' WHERE value_type = '1'");
      $ret[] = db_query("UPDATE {votingapi_cache} SET value_type = 'points' WHERE value_type = '2'");
      $ret[] = db_query("UPDATE {votingapi_cache} SET value_type = 'option' WHERE value_type = '3'");
      $ret[] = db_query("UPDATE {votingapi_vote} SET value_type = 'percent' WHERE value_type = '1'");
      $ret[] = db_query("UPDATE {votingapi_vote} SET value_type = 'points' WHERE value_type = '2'");
      $ret[] = db_query("UPDATE {votingapi_vote} SET value_type = 'option' WHERE value_type = '3'");
      break;
  }
  return $ret;
}