You are here

function login_history_schema in Login History 6

Same name and namespace in other branches
  1. 8 login_history.install \login_history_schema()
  2. 7 login_history.install \login_history_schema()

Implements hook_schema().

File

./login_history.install, line 6

Code

function login_history_schema() {
  $schema['login_history'] = array(
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'uid of user.',
      ),
      'login' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => "Timestamp for user's login.",
      ),
      'hostname' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => "The user's host name.",
      ),
      'one_time' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'Indicates whether the login was from a one-time login link (e.g. password reset).',
      ),
      'user_agent' => array(
        'type' => 'varchar',
        'length' => 256,
        'not null' => TRUE,
        'default' => '',
        'description' => 'User agent (i.e. browser) of the device used during the login.',
      ),
    ),
    'indexes' => array(
      'login_history_uid' => array(
        'uid',
      ),
      'login_history_onetime' => array(
        'one_time',
      ),
      'login_history_uid_host_ua' => array(
        'uid',
        'hostname',
        array(
          'user_agent',
          255,
        ),
      ),
    ),
  );
  return $schema;
}