You are here

function auto_login_url_schema in Auto Login URL 7

Same name and namespace in other branches
  1. 8 auto_login_url.install \auto_login_url_schema()
  2. 2.x auto_login_url.install \auto_login_url_schema()

Implements hook_schema().

File

./auto_login_url.install, line 11
Install file.

Code

function auto_login_url_schema() {
  $schema['auto_login_url'] = array(
    'description' => 'Auto login records.',
    'fields' => array(
      'id' => array(
        'description' => 'ID of the record.',
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Primary Key: {users}.uid for user.',
      ),
      'hash' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
        'default' => '',
        'description' => 'Unique hash tag for the generated link.',
      ),
      'destination' => array(
        'type' => 'varchar',
        'length' => 1000,
        'not null' => FALSE,
        'default' => '',
        'description' => 'The destination after user login.',
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp of the creation of the auto login link.',
      ),
    ),
    'indexes' => array(
      'hash_index' => array(
        'hash',
      ),
      'timestamp_index' => array(
        'timestamp',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'foreign keys' => array(
      'user' => array(
        'table' => 'users',
        'columns' => array(
          'uid' => 'uid',
        ),
      ),
    ),
  );
  return $schema;
}