View source
<?php
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;
}
function login_history_install() {
drupal_install_schema('login_history');
}
function login_history_uninstall() {
drupal_uninstall_schema('login_history');
}