You are here

function uc_stock_install in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_stock/uc_stock.install \uc_stock_install()

File

uc_stock/uc_stock.install, line 3

Code

function uc_stock_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      db_query("CREATE TABLE {uc_product_stock} (\n        `sku` varchar(255) NOT NULL,\n        `nid` mediumint(9) NOT NULL,\n        `active` tinyint(2) NOT NULL default 0,\n        `stock` mediumint(11) NOT NULL default 0,\n        `threshold` mediumint(11) NOT NULL default 0,\n        PRIMARY KEY (`sku`),\n        KEY nid (nid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {uc_product_stock} (\n        sku varchar(255) NOT NULL default '',\n        nid integer NOT NULL default 0,\n        active smallint NOT NULL default 0,\n        stock integer NOT NULL default 0,\n        threshold integer NOT NULL default 0,\n        PRIMARY KEY (sku)\n      );");
      db_query("CREATE INDEX {uc_product_stock}_nid ON {uc_product_stock} (nid)");
      break;
  }
  variable_del('uc_stock_threshold_notification');
  variable_del('uc_stock_threshold_notification_recipients');
  variable_del('uc_stock_threshold_notification_subject');
  variable_del('uc_stock_threshold_notification_message');
  variable_del('uc_stock_threshold_notification_format');
}