You are here

function ip_schema in IP address manager 7

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

Implements hook_schema().

File

./ip.install, line 18
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 sort of created item.',
      ),
      'id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The Node/Comment ID',
      ),
      'ip' => array(
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'description' => 'The User IP address',
      ),
    ),
    'primary key' => array(
      'id',
      'type',
    ),
  );
  return $schema;
}