You are here

function badbehavior_schema in Bad Behavior 6.2

Same name and namespace in other branches
  1. 6 badbehavior.install \badbehavior_schema()
  2. 7.2 badbehavior.install \badbehavior_schema()

Implements hook_schema().

File

./badbehavior.install, line 11
Install, update and uninstall functions for the Bad Behavior module.

Code

function badbehavior_schema() {
  $schema['bad_behavior_log'] = array(
    'description' => 'Stores hit logs for the Bad Behavior module.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'ip' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'date' => array(
        'type' => 'datetime',
        'not null' => TRUE,
        'default' => '1970-01-01 00:00:00',
      ),
      'request_method' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'request_uri' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'server_protocol' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'http_headers' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'user_agent' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'request_entity' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'key' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'ip' => array(
        array(
          'ip',
          15,
        ),
      ),
      'user_agent' => array(
        array(
          'user_agent',
          10,
        ),
      ),
    ),
  );
  return $schema;
}