You are here

uc_cart_links.install in Ubercart 5

File

uc_cart_links/uc_cart_links.install
View source
<?php

function uc_cart_links_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {uc_cart_link_clicks} (\n        cart_link_id varchar(32) NOT NULL default '0',\n        clicks int(10) NOT NULL default '0',\n        last_click int(10) NOT NULL default '0',\n        PRIMARY KEY cart_link_id (cart_link_id)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {uc_cart_link_clicks} (\n        cart_link_id varchar(32) NOT NULL default 0,\n        clicks integer NOT NULL default 0,\n        last_click integer NOT NULL default 0,\n        PRIMARY KEY (cart_link_id)\n      )");
      db_query("CREATE INDEX {uc_cart_link_clicks}_cart_link_id ON {uc_cart_link_clicks} (cart_link_id)");
      break;
  }
}
function uc_cart_links_uninstall() {
  db_query("DROP TABLE {uc_cart_link_clicks}");
  db_query("DELETE FROM {variable} WHERE name LIKE 'uc_cart_links_%%'");
  cache_clear_all('variables', 'cache');
}

/**
 * Remove obsolete variable.
 */
function uc_cart_links_update_1() {
  variable_del('uc_cart_links_empty');
  return array();
}

Functions