You are here

function ad_update_7 in Advertisement 5.2

Same name and namespace in other branches
  1. 5 ad.install \ad_update_7()

Add a user_agent column to the ad_clicks table so it's possible to filter out clicks based on the agent (ie, if it reports itself as a bot).

File

./ad.install, line 334

Code

function ad_update_7() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {ad_clicks} ADD user_agent varchar(255) NOT NULL DEFAULT '' AFTER hostname");
      $ret[] = update_sql("ALTER TABLE {ad_clicks} ADD KEY (user_agent)");
      break;
    case 'pgsql':
      db_add_column($ret, 'ad_clicks', 'user_agent', 'varchar(255)', array(
        'not null' => TRUE,
        'default' => "''",
      ));
      break;
  }
  return $ret;
}