You are here

function user_badges_update_1 in User Badges 5

Implementation of hook_update_N() new DB structure

File

./user_badges.install, line 92
@brief User Badges install file

Code

function user_badges_update_1() {
  $done = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $done[] = db_query('
        ALTER TABLE {user_badges_badges}
        ADD href VARCHAR(80) default ""
        AFTER weight
      ');
      $done[] = db_query('
        ALTER TABLE {user_badges_badges}
        ADD PRIMARY KEY (bid)
      ');
      break;
    case 'pgsql':
      $done[] = db_query('
        ALTER TABLE {user_badges_badges} ADD COLUMN href VARCHAR(80)
      ');
      $done[] = db_query('
        ALTER TABLE {user_badges_badges} ALTER COLUMN href SET DEFAULT ""
      ');
      break;
    default:
      break;
  }
  return $done;
}