You are here

function autoban_schema in Automatic IP ban (Autoban) 7

Implements hook_schema().

File

./autoban.install, line 11
Installation functions for autoban module.

Code

function autoban_schema() {
  $schema = array();
  $schema['autoban'] = array(
    'fields' => array(
      'rid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The primary identifier for a rule.',
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Type of log message, for example "page not found."',
      ),
      'message' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => 'Pattern of log message.',
      ),
      'threshold' => array(
        'type' => 'int',
        'not null' => TRUE,
        'size' => 'small',
        'default' => 1,
        'description' => 'The threshold number of the log entries.',
      ),
      'user_type' => array(
        'type' => 'int',
        'not null' => TRUE,
        'size' => 'small',
        'default' => 0,
        'description' => 'The users type: anonymous, authenticated or any.',
      ),
      'ip_type' => array(
        'type' => 'int',
        'not null' => TRUE,
        'size' => 'small',
        'default' => 0,
        'description' => 'Single IP or IP range.',
      ),
      'referer' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'URL of referring page.',
      ),
      'created' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp for when rule was created.',
      ),
      'changed' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp for when rule was created.',
      ),
    ),
    'primary key' => array(
      'rid',
    ),
    'indexes' => array(
      'type' => array(
        'type',
      ),
    ),
  );
  return $schema;
}