You are here

continents_api.install in Country codes API 6

Same filename and directory in other branches
  1. 5 contrib/continents_api/continents_api.install

Install file for Continents API.

File

contrib/continents_api/continents_api.install
View source
<?php

/**
 * @file
 * Install file for Continents API.
 */

/**
 * Implementation of hook_schema().
 */
function continents_api_schema() {
  $schema['continents_api_continents'] = array(
    'description' => 'Mapping of continent codes to country codes.',
    'fields' => array(
      'continent' => array(
        'description' => 'Continent code.',
        'type' => 'char',
        'length' => 2,
        'not null' => TRUE,
      ),
      'country' => array(
        'description' => 'ISO 3166 alpha-2 country code.',
        'type' => 'char',
        'length' => 2,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'continent',
      'country',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function continents_api_install() {

  // Create tables.
  drupal_install_schema('continents_api');

  // Include continents_api module include for initial data import.
  require_once dirname(__FILE__) . '/continents_api.module';
  continents_api_csv_import_continents();
}

/**
 * Implementation of hook_uninstall().
 */
function continents_api_uninstall() {

  // Remove tables.
  drupal_uninstall_schema('continents_api');
}

Functions

Namesort descending Description
continents_api_install Implementation of hook_install().
continents_api_schema Implementation of hook_schema().
continents_api_uninstall Implementation of hook_uninstall().