You are here

function uc_store_install in Ubercart 5

Same name and namespace in other branches
  1. 8.4 uc_store/uc_store.install \uc_store_install()
  2. 6.2 uc_store/uc_store.install \uc_store_install()
  3. 7.3 uc_store/uc_store.install \uc_store_install()

File

uc_store/uc_store.install, line 3

Code

function uc_store_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      db_query("CREATE TABLE {uc_countries} (\n        country_id mediumint(11) NOT NULL,\n        country_name varchar(255) NOT NULL,\n        country_iso_code_2 char(2) NOT NULL,\n        country_iso_code_3 char(3) NOT NULL,\n        version smallint(11) NOT NULL default '0',\n        PRIMARY KEY (country_id),\n        KEY country_name (country_name)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {uc_zones} (\n        zone_id mediumint(11) NOT NULL,\n        zone_country_id mediumint(11) NOT NULL default '0',\n        zone_code varchar(32) NOT NULL default '',\n        zone_name varchar(255) NOT NULL default '',\n        PRIMARY KEY (zone_id),\n        KEY zone_code (zone_code),\n        KEY zone_country_id (zone_country_id)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */");
      db_query("CREATE TABLE {uc_store_footers} (\n        `path_hash` varchar(32) NOT NULL default '',\n        `message` text NOT NULL,\n        PRIMARY KEY (path_hash)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {uc_countries} (\n        country_id integer NOT NULL default 0,\n        country_name varchar(255) NOT NULL default '',\n        country_iso_code_2 char(2) NOT NULL default '',\n        country_iso_code_3 char(3) NOT NULL default '',\n        version integer NOT NULL default '0',\n        PRIMARY KEY (country_id)\n      );");
      db_query("CREATE INDEX {uc_countries}_country_name ON {uc_countries} (country_name)");
      db_query("CREATE INDEX {uc_countries}_country_id ON {uc_countries} (country_id)");
      db_query("CREATE TABLE {uc_zones} (\n        zone_id serial NOT NULL,\n        zone_country_id integer NOT NULL default 0,\n        zone_code varchar(32) NOT NULL default '',\n        zone_name varchar(255) NOT NULL default '',\n        PRIMARY KEY (zone_id)\n      );");
      db_query("CREATE INDEX {uc_zones}_zone_code ON {uc_zones} (zone_code)");
      db_query("CREATE INDEX {uc_zones}_zone_country_id ON {uc_zones} (zone_country_id)");
      db_query("CREATE TABLE {uc_store_footers} (\n        path_hash varchar(32) NOT NULL default '',\n        message text NOT NULL default '',\n        PRIMARY KEY (path_hash)\n      )");
      break;
  }

  // Install United States and Canada by default.
  $path = drupal_get_path('module', 'uc_store');
  require_once $path . '/countries/united_states_840_1.cif';
  require_once $path . '/countries/canada_124_1.cif';
  united_states_install();
  canada_install();
}