You are here

function smart_ip_schema_definition_array in Smart IP 6

Same name and namespace in other branches
  1. 6.2 smart_ip.install \smart_ip_schema_definition_array()
  2. 7.2 smart_ip.install \smart_ip_schema_definition_array()
  3. 7 smart_ip.install \smart_ip_schema_definition_array()

Smart IP schema definition array.

Return value

A Schema API table definition array.

3 calls to smart_ip_schema_definition_array()
smart_ip_check_fix_local_db in ./smart_ip.module
Ensure smart_ip table exist
smart_ip_schema in ./smart_ip.install
Implements hook_schema().
smart_ip_update_database in includes/smart_ip.utility.inc

File

./smart_ip.install, line 57

Code

function smart_ip_schema_definition_array() {
  return array(
    'description' => 'Association between IP range and Geo location',
    'fields' => array(
      'geoip_id' => array(
        'description' => 'ID assigned by maxmind',
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
      ),
      'ip_ref' => array(
        'description' => 'Lowest IP Address in Range',
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
      ),
      'country_code' => array(
        'description' => 'ISO 3166 2-Character Country Code',
        'type' => 'varchar',
        'length' => 3,
        'not null' => TRUE,
      ),
      'region' => array(
        'description' => '2-Character Region Code',
        'type' => 'varchar',
        'length' => 3,
        'not null' => FALSE,
      ),
      'city' => array(
        'description' => 'Name of city targeted by the coordinates',
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
      ),
      'zip' => array(
        'description' => 'Postal code of targeted by the coordinates',
        'type' => 'varchar',
        'length' => 8,
        'not null' => FALSE,
      ),
      'latitude' => array(
        'description' => 'Latitude',
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
      ),
      'longitude' => array(
        'description' => 'Longitude',
        'type' => 'float',
        'size' => 'big',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'ip_ref',
    ),
    'indexes' => array(
      'geoip_id' => array(
        'geoip_id',
      ),
    ),
  );
}