You are here

function password_policy_schema in Password Policy 6

Same name and namespace in other branches
  1. 7.2 password_policy.install \password_policy_schema()
  2. 7 password_policy.install \password_policy_schema()

Implements hook_schema().

File

./password_policy.install, line 11
File module installation and upgrade code.

Code

function password_policy_schema() {
  return array(
    'password_policy' => array(
      'description' => "Stores password policies.",
      'fields' => array(
        'pid' => array(
          'description' => "Primary Key: Unique password policy ID.",
          'type' => 'serial',
          'not null' => TRUE,
        ),
        'name' => array(
          'description' => "The name of the policy.",
          'type' => 'varchar',
          'length' => 64,
          'not null' => TRUE,
          'default' => '',
        ),
        'description' => array(
          'description' => "The description of the policy.",
          'type' => 'varchar',
          'length' => 255,
          'default' => '',
        ),
        'enabled' => array(
          'description' => "Whether the policy is enabled.",
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
          'size' => 'tiny',
        ),
        'policy' => array(
          'description' => "The policy's serialized data.",
          'type' => 'varchar',
          'length' => 1024,
          'not null' => TRUE,
          'default' => '',
        ),
        'created' => array(
          'description' => "Timestamp for when the policy was created.",
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'expiration' => array(
          'description' => "The passwords will expire after this number of days.",
          'type' => 'int',
        ),
        'warning' => array(
          'description' => "Comma separated list of days when warning is sent out.",
          'type' => 'varchar',
          'length' => 64,
        ),
        'weight' => array(
          'description' => "Weight of the policy, used to order active policies.",
          'type' => 'int',
          'size' => 'tiny',
          'not null' => TRUE,
          'default' => 0,
        ),
      ),
      'primary key' => array(
        'pid',
      ),
      'unique keys' => array(
        'name' => array(
          'name',
        ),
      ),
    ),
    'password_policy_history' => array(
      'description' => "Stores users' old password hashes.",
      'fields' => array(
        'pid' => array(
          'description' => "Primary Key: Unique password policy users ID.",
          'type' => 'serial',
          'not null' => TRUE,
        ),
        'uid' => array(
          'description' => "User's {users}.uid.",
          'type' => 'int',
          'not null' => TRUE,
        ),
        'pass' => array(
          'description' => "User's password (hashed).",
          'type' => 'varchar',
          'length' => 128,
          'not null' => TRUE,
        ),
        'created' => array(
          'description' => "Timestamp for when the policy was created.",
          'type' => 'int',
          'not null' => TRUE,
        ),
      ),
      'primary key' => array(
        'pid',
      ),
      'indexes' => array(
        'uid' => array(
          'uid',
        ),
      ),
    ),
    'password_policy_expiration' => array(
      'description' => 'Stores users password expiration data.',
      'fields' => array(
        'pid' => array(
          'description' => "Primary Key: Unique password policy expirations ID.",
          'type' => 'serial',
          'not null' => TRUE,
        ),
        'uid' => array(
          'description' => "User's {users}.uid.",
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'warning' => array(
          'description' => "Timestamp for when the warning was shown.",
          'type' => 'int',
        ),
        'blocked' => array(
          'description' => "Timestamp for when the user was blocked.",
          'type' => 'int',
        ),
        'unblocked' => array(
          'description' => "Timestamp for when the user was unblocked.",
          'type' => 'int',
        ),
      ),
      'primary key' => array(
        'pid',
      ),
      'indexes' => array(
        'uid' => array(
          'uid',
        ),
      ),
    ),
    'password_policy_force_change' => array(
      'description' => 'Forced password reset status.',
      'fields' => array(
        'uid' => array(
          'type' => 'int',
          'not null' => TRUE,
        ),
        'force_change' => array(
          'type' => 'int',
          'default' => 0,
        ),
      ),
      'indexes' => array(
        'uid' => array(
          'uid',
        ),
      ),
    ),
    'password_policy_role' => array(
      'description' => "Links policies with roles.",
      'fields' => array(
        'rid' => array(
          'description' => "Role ID.",
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'pid' => array(
          'description' => "Policy ID.",
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'name' => array(
          'description' => "The name of the policy.",
          'type' => 'varchar',
          'length' => 64,
          'not null' => TRUE,
          'default' => '',
        ),
      ),
      'primary key' => array(
        'rid',
        'pid',
      ),
      'unique keys' => array(
        'name' => array(
          'rid',
          'name',
        ),
      ),
    ),
  );
  return $schema;
}