You are here

function persistent_login_schema in Persistent Login 8

Same name and namespace in other branches
  1. 6 persistent_login.install \persistent_login_schema()
  2. 7 persistent_login.install \persistent_login_schema()

Implements hook_schema().

File

./persistent_login.install, line 11
Installation functions for Persistent Login module.

Code

function persistent_login_schema() {
  $schema = [];
  $schema['persistent_login'] = [
    'description' => 'Stores Persistent Login tokens for users',
    'fields' => [
      'uid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The {users}.uid this row is for.',
      ],
      'series' => [
        'type' => 'varchar',
        'length' => 43,
        'not null' => TRUE,
        'description' => 'The long-lived value identifying the token sequence.',
      ],
      'instance' => [
        'type' => 'varchar',
        'length' => 43,
        'not null' => TRUE,
        'description' => 'The single-use value.',
      ],
      'created' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The creation timestamp for this series.',
      ],
      'refreshed' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The refresh timestamp for this series.',
      ],
      'expires' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The expiration timestamp for this series.',
      ],
    ],
    'primary key' => [
      'series',
    ],
    'indexes' => [
      'expires' => [
        'expires',
      ],
      'uid_expires' => [
        'uid',
        'expires',
      ],
    ],
  ];
  return $schema;
}