You are here

function auto_login_url_schema in Auto Login URL 2.x

Same name and namespace in other branches
  1. 8 auto_login_url.install \auto_login_url_schema()
  2. 7 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'] = [
    'description' => 'Auto login records.',
    'fields' => [
      'id' => [
        'description' => 'ID of the record.',
        'type' => 'serial',
        'not null' => TRUE,
      ],
      'uid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Primary Key: {users}.uid for user.',
      ],
      'hash' => [
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
        'default' => '',
        'description' => 'Unique hash tag for the generated link.',
      ],
      'destination' => [
        'type' => 'varchar',
        'length' => 1000,
        'not null' => FALSE,
        'default' => '',
        'description' => 'The destination after user login.',
      ],
      'timestamp' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp of the creation of the auto login link.',
      ],
    ],
    'indexes' => [
      'hash_index' => [
        'hash',
      ],
      'timestamp_index' => [
        'timestamp',
      ],
    ],
    'primary key' => [
      'id',
    ],
    'foreign keys' => [
      'user' => [
        'table' => 'users',
        'columns' => [
          'uid' => 'uid',
        ],
      ],
    ],
  ];
  return $schema;
}