You are here

function visitors_geoip_schema_alter in Visitors 7.2

Same name and namespace in other branches
  1. 8.2 visitors_geoip.install \visitors_geoip_schema_alter()
  2. 8 visitors_geoip.install \visitors_geoip_schema_alter()
  3. 7 visitors_geoip.install \visitors_geoip_schema_alter()

Update {visitors} table, add geoip support.

File

./visitors_geoip.install, line 13
Install/uninstall visitors geoip module.

Code

function visitors_geoip_schema_alter(&$schema) {
  $schema['visitors'] = array(
    'fields' => array(
      'visitors_continent_code' => array(
        'type' => 'varchar',
        'length' => 2,
        'not null' => TRUE,
        'default' => '',
      ),
      'visitors_country_code' => array(
        'type' => 'varchar',
        'length' => 2,
        'not null' => TRUE,
        'default' => '',
      ),
      'visitors_country_code3' => array(
        'type' => 'varchar',
        'length' => 3,
        'not null' => TRUE,
        'default' => '',
      ),
      'visitors_country_name' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'visitors_region' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'visitors_city' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'visitors_postal_code' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'visitors_latitude' => array(
        'type' => 'numeric',
        'precision' => 13,
        'scale' => 10,
        'not null' => TRUE,
        'default' => 0,
      ),
      'visitors_longitude' => array(
        'type' => 'numeric',
        'precision' => 13,
        'scale' => 10,
        'not null' => TRUE,
        'default' => 0,
      ),
      'visitors_dma_code' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'visitors_area_code' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
    ),
  );
  return $schema;
}