You are here

function countries_schema in Countries 8

Same name and namespace in other branches
  1. 7.2 countries.install \countries_schema()
  2. 7 countries.install \countries_schema()

Implements hook_schema().

File

./countries.install, line 11
Install file for Countries module.

Code

function countries_schema() {
  $schema['countries_country'] = array(
    'description' => 'Maintains a country database.',
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary Key: Unique country ID. Required for the country bundle.',
      ),
      'iso2' => array(
        'description' => 'ISO 3166-1 alpha-2 country code.',
        'type' => 'char',
        'length' => 2,
        'not null' => TRUE,
      ),
      'iso3' => array(
        'description' => 'ISO 3166-1 alpha-3 country code.',
        'type' => 'char',
        'length' => 3,
        'not null' => FALSE,
      ),
      'name' => array(
        'description' => 'ISO 3166-1 official short name.',
        'type' => 'varchar',
        'length' => 95,
        'not null' => TRUE,
      ),
      'official_name' => array(
        'description' => 'ISO 3166-1 official long name.',
        'type' => 'varchar',
        'length' => 127,
        'not null' => TRUE,
      ),
      'numcode' => array(
        'description' => 'ISO 3166-1 numeric-3 country code.',
        'type' => 'int',
        'size' => 'small',
        'not null' => FALSE,
      ),
      'continent' => array(
        'description' => 'Continent code.',
        'type' => 'char',
        'length' => 2,
        'not null' => TRUE,
      ),
      'enabled' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
        'description' => 'Whether the country is enabled.',
      ),
      'language' => array(
        'description' => 'The {languages}.language of this node.',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => LANGUAGE_NONE,
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'unique keys' => array(
      'iso2' => array(
        'iso2',
      ),
      'name' => array(
        'name',
      ),
    ),
    'indexes' => array(
      'enabled' => array(
        'enabled',
      ),
      'continent' => array(
        'continent',
      ),
    ),
  );
  return $schema;
}