You are here

function persistent_login_schema in Persistent Login 6

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

Implementation of hook_schema().

File

./persistent_login.install, line 11
Implementation of installation/uninstallation hooks.

Code

function persistent_login_schema() {
  $schema = array();
  $schema['persistent_login'] = array(
    'description' => 'Stores Persistent Login (PL) information for users that check Remember me when they log in.  If this info matches an anonymous user\'s PL cookie, they are logged in automatically.  See http://jaspan.com/improved_persistent_login_cookie_best_practice for details on the technique used.',
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => 1,
        'not null' => 1,
        'description' => 'The {users}.uid this row is for.',
      ),
      'series' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => 1,
        'description' => 'The long-lived series identifying the PL token sequence.',
      ),
      'token' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => 1,
        'description' => 'The single-use PL login token.',
      ),
      'expires' => array(
        'type' => 'int',
        'unsigned' => 1,
        'not null' => 1,
        'description' => 'The expiration date for this series of tokens.',
      ),
    ),
    'primary key' => array(
      'uid',
      'series',
    ),
    'indexes' => array(
      'expires' => array(
        'expires',
      ),
      'uid_expires' => array(
        'uid',
        'expires',
      ),
    ),
  );
  $schema['persistent_login_history'] = array(
    'description' => 'Stores previous entries from the {persistent_login} table just before they are erased.  The uid, series, token, and expires fields are copied verbatim.',
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => 1,
        'not null' => 1,
      ),
      'series' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => 1,
      ),
      'token' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => 1,
      ),
      'expires' => array(
        'type' => 'int',
        'unsigned' => 1,
        'not null' => 1,
      ),
      'at' => array(
        'type' => 'int',
        'unsigned' => 1,
        'not null' => 1,
        'description' => 'When this entry was copied from the {persistent_login} table.',
      ),
      'why' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => 1,
        'description' => 'Why this entry was deleted from the {persistent_login} table.',
      ),
    ),
    'primary key' => array(
      'uid',
      'series',
      'token',
    ),
    'indexes' => array(
      'expires' => array(
        'at',
      ),
    ),
  );
  return $schema;
}