You are here

function ip_schema in IP address manager 8.2

Same name and namespace in other branches
  1. 6 ip.install \ip_schema()
  2. 7.2 ip.install \ip_schema()
  3. 7 ip.install \ip_schema()

Implements hook_schema().

File

./ip.install, line 11
IP address manager module install file.

Code

function ip_schema() {
  $schema['ip_tracker'] = array(
    'description' => 'Stores IP addresses against uids.',
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The User ID',
      ),
      'ip' => array(
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'description' => 'The User IP address',
      ),
      'visits' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'How many visits with this uid/ip combination',
      ),
      'first_visit' => array(
        'description' => 'A Unix timestamp indicating when this record was created.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'last_visit' => array(
        'description' => 'A Unix timestamp indicating when this record was updated.',
        'type' => 'int',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'uid',
      'ip',
    ),
  );
  $schema['ip_posts'] = array(
    'description' => 'Stores ips against nids/cids.',
    'fields' => array(
      'type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The entity type.',
      ),
      'id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The entity id',
      ),
      'ip' => array(
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'description' => 'The User IP address',
      ),
    ),
    'primary key' => array(
      'id',
      'type',
    ),
  );
  return $schema;
}