| 1 |
|
<?php |
| 2 |
|
// $Id$ |
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* @file |
| 6 |
|
* Install file for Continents API. |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
|
/** |
| 10 |
|
* Implementation of hook_schema(). |
| 11 |
|
*/ |
| 12 |
|
function continents_api_schema() { |
| 13 |
|
$schema['continents_api_continents'] = array( |
| 14 |
|
'description' => 'Mapping of continent codes to country codes.', |
| 15 |
|
'fields' => array( |
| 16 |
|
'continent' => array( |
| 17 |
|
'description' => 'Continent code.', |
| 18 |
|
'type' => 'char', |
| 19 |
|
'length' => 2, |
| 20 |
|
'not null' => TRUE, |
| 21 |
|
), |
| 22 |
|
'country' => array( |
| 23 |
|
'description' => 'ISO 3166 alpha-2 country code.', |
| 24 |
|
'type' => 'char', |
| 25 |
|
'length' => 2, |
| 26 |
|
'not null' => TRUE, |
| 27 |
|
), |
| 28 |
|
), |
| 29 |
|
'primary key' => array('continent', 'country'), |
| 30 |
|
); |
| 31 |
|
|
| 32 |
|
return $schema; |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
/** |
| 36 |
|
* Implementation of hook_install(). |
| 37 |
|
*/ |
| 38 |
|
function continents_api_install() { |
| 39 |
|
// Create tables. |
| 40 |
|
drupal_install_schema('continents_api'); |
| 41 |
|
|
| 42 |
|
// Include continents_api module include for initial data import. |
| 43 |
|
require_once(dirname(__FILE__) .'/continents_api.module'); |
| 44 |
|
continents_api_csv_import_continents(); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
/** |
| 48 |
|
* Implementation of hook_uninstall(). |
| 49 |
|
*/ |
| 50 |
|
function continents_api_uninstall() { |
| 51 |
|
// Remove tables. |
| 52 |
|
drupal_uninstall_schema('continents_api'); |
| 53 |
|
} |