You are here

function uc_flatrate_install in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_flatrate/uc_flatrate.install \uc_flatrate_install()

File

shipping/uc_flatrate/uc_flatrate.install, line 3

Code

function uc_flatrate_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {uc_flatrate_products} (\n        `vid` mediumint(9) unsigned NOT NULL default 0,\n        `nid` mediumint(9) unsigned NOT NULL default 0,\n        `mid` mediumint(9) unsigned NOT NULL default 0,\n        `rate` decimal(10,2) NOT NULL default 0.00,\n        PRIMARY KEY (`vid`, `mid`)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ;");
      db_query("CREATE TABLE {uc_flatrate_methods} (\n        `mid` mediumint(9) unsigned NOT NULL default 0,\n        `title` varchar(255) NOT NULL default '',\n        `label` varchar(255) NOT NULL default '',\n        `base_rate` decimal(10,2) NOT NULL default 0.00,\n        `product_rate` decimal(10,2) NOT NULL default 0.00,\n        PRIMARY KEY (`mid`)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {uc_flatrate_products} (\n        vid int_unsigned NOT NULL default 0,\n        nid int_unsigned NOT NULL default 0,\n        mid int_unsigned NOT NULL default 0,\n        rate decimal(10,2) NOT NULL default 0.00,\n        PRIMARY KEY (vid, mid)\n      );");
      db_query("CREATE TABLE {uc_flatrate_methods} (\n        mid serial NOT NULL,\n        title varchar(255) NOT NULL default '',\n        label varchar(255) NOT NULL default '',\n        base_rate decimal(10,2) NOT NULL default 0.00,\n        product_rate decimal(10,2) NOT NULL default 0.00,\n        PRIMARY KEY (mid)\n      );");
      db_query("CREATE INDEX {uc_flatrate_methods}_mid_idx ON {uc_flatrate_methods}(mid)");
      break;
  }
}