You are here

function login_security_schema in Login Security 8

Same name and namespace in other branches
  1. 6 login_security.install \login_security_schema()
  2. 7 login_security.install \login_security_schema()
  3. 2.x login_security.install \login_security_schema()

Implements hook_schema().

File

./login_security.install, line 11
Login Security installation routines.

Code

function login_security_schema() {
  $schema['login_security_track'] = [
    'description' => 'Keeps track of failed login attempts, as a pair of the IP address and user name.',
    'fields' => [
      'id' => [
        'type' => 'serial',
        'not null' => TRUE,
        'description' => "ID of each login event.",
      ],
      'host' => [
        'type' => 'varchar',
        'length' => 39,
        'not null' => TRUE,
        'default' => '',
        'description' => "The IP address of the request.",
      ],
      'name' => [
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
        'description' => "Clean username, submitted using the login form.",
      ],
      'timestamp' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "Timestamp of the event.",
      ],
    ],
    'indexes' => [
      'name' => [
        'name',
      ],
      'host' => [
        'host',
      ],
      'timestamp' => [
        'timestamp',
      ],
    ],
    'primary key' => [
      'id',
    ],
  ];
  return $schema;
}