You are here

function force_password_change_schema in Force Password Change 2.0.x

Same name and namespace in other branches
  1. 8 force_password_change.install \force_password_change_schema()
  2. 6.3 force_password_change.install \force_password_change_schema()
  3. 6.2 force_password_change.install \force_password_change_schema()
  4. 7.2 force_password_change.install \force_password_change_schema()
  5. 7 force_password_change.install \force_password_change_schema()

Implements hook_schema().

File

./force_password_change.install, line 42

Code

function force_password_change_schema() {

  // This table contains one row for each role, and holds stats
  // regarding the last time the members of the role were forced
  // to change their password.
  $schema['force_password_change_roles'] = [
    'description' => 'Holds the time of the last forced password change by role',
    'fields' => [
      'rid' => [
        'description' => 'The role ID from table',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'last_force' => [
        'description' => 'A UNIX timestamp referring to the last date on which users in the role were forced to change their password',
        'type' => 'int',
        'unsigned' => TRUE,
        'length' => 10,
      ],
    ],
    'primary key' => [
      'rid',
    ],
  ];

  // This table contains data regarding the time period after which
  // passwords should expire for members in that role. For example,
  // autheticated users may be forced to change their password once
  // a month.
  $schema['force_password_change_expiry'] = [
    'description' => 'Holds information related to the expiry of passwords by role',
    'fields' => [
      'rid' => [
        'description' => 'The Role ID',
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 128,
      ],
      'expiry' => [
        'description' => 'The number of seconds after which a user will be forced to reset their password',
        'type' => 'int',
        'unsigned' => TRUE,
        'default' => 0,
      ],
      'weight' => [
        'description' => 'Allows for priorities to be applied to password expirations',
        'type' => 'int',
        'default' => 0,
      ],
    ],
    'primary key' => [
      'rid',
    ],
  ];
  $schema['force_password_change_uids'] = [
    'description' => 'Stores various lists of UIDs for the Force Password Change module',
    'fields' => [
      'category' => [
        'description' => 'The category to which the UID belongs',
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
      ],
      'uid' => [
        'description' => 'The User ID',
        'type' => 'int',
        'not null' => TRUE,
      ],
    ],
    'primary key' => [
      'category',
      'uid',
    ],
  ];
  return $schema;
}