You are here

function countries_api_update_5101 in Country codes API 5

Implementation of hook_update_N().

File

./countries_api.install, line 36

Code

function countries_api_update_5101() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':

      // Drop table if exists.
      db_query("DROP TABLE IF EXISTS {countries_api_countries}");

      // Create countries DB table.
      $ret[] = update_sql("CREATE TABLE {countries_api_countries} (\n        iso2 char(2) NOT NULL DEFAULT '',\n        iso3 char(3) NOT NULL,\n        name varchar(80) NOT NULL,\n        printable_name varchar(80) NOT NULL,\n        numcode smallint(6),\n        PRIMARY KEY (iso2)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
  }

  //Include country module include for initial data import
  require_once dirname(__FILE__) . '/countries_api.module';
  countries_api_csv_import_countries();
  return $ret;
}