You are here

function advban_schema in Advanced ban 8

Implements hook_schema().

File

./advban.install, line 11
Install, update and uninstall functions for the Advban module.

Code

function advban_schema() {
  $schema['advban_ip'] = [
    'description' => 'Stores banned IP addresses.',
    'fields' => [
      'iid' => [
        'description' => 'Primary Key: unique ID for IP addresses.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'ip' => [
        'description' => 'IP address (or begin, if range)',
        'type' => 'varchar_ascii',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
      ],
      'ip_end' => [
        'description' => 'IP address (end, if range)',
        'type' => 'varchar_ascii',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
      ],
      'expiry_date' => [
        'description' => 'Timestamp for when this IP address can be unblocked.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'indexes' => [
      'ip' => [
        'ip',
      ],
    ],
    'primary key' => [
      'iid',
    ],
  ];
  return $schema;
}