function ip2country_schema in IP-based Determination of a Visitor's Country 8
Same name and namespace in other branches
- 6 ip2country.install \ip2country_schema()
- 7 ip2country.install \ip2country_schema()
Implements hook_schema().
File
- ./
ip2country.install, line 14 - Install, update, and uninstall functions for the ip2country module.
Code
function ip2country_schema() {
$schema['ip2country'] = [
'description' => 'Association between IP range and Country',
'fields' => [
'ip2country_id' => [
'description' => 'Row number (why is this needed?)',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'country' => [
'description' => 'ISO 3166 2-character country code',
'type' => 'char',
'length' => 3,
'not null' => TRUE,
],
'registry' => [
'description' => 'Regional Internet Registry',
'type' => 'char',
'length' => 10,
'not null' => TRUE,
],
'ip_range_first' => [
'description' => 'Lowest IP address in range',
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
],
'ip_range_last' => [
'description' => 'Highest IP address in range',
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
],
'ip_range_length' => [
'description' => 'Size of IP address block',
'type' => 'int',
'not null' => TRUE,
],
],
'indexes' => [
'country_registry' => [
'country',
'registry',
],
],
'primary key' => [
'ip2country_id',
],
];
return $schema;
}