You are here

function password_policy_schema in Password Policy 7

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

Implements hook_schema().

File

./password_policy.install, line 11
Password Policy 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',
        ),
        'constraints' => array(
          'description' => 'The policy\'s serialized constraints.',
          'type' => 'varchar',
          'length' => 1024,
          'not null' => TRUE,
          'default' => '',
          'serialize' => TRUE,
        ),
        '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',
          'default' => 0,
        ),
        '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 user\'s 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(
          'type' => 'varchar',
          'length' => 128,
          'not null' => TRUE,
          'default' => '',
          'description' => 'User\'s password (hashed).',
        ),
        'created' => array(
          'description' => 'Timestamp for when the policy was created.',
          'type' => 'int',
          'not null' => TRUE,
        ),
      ),
      'foreign keys' => array(
        'password_policy' => array(
          'table' => 'password_policy',
          'columns' => array(
            'pid' => 'pid',
          ),
        ),
        'user' => array(
          'table' => 'users',
          'columns' => array(
            'uid' => 'uid',
          ),
        ),
      ),
      'indexes' => array(
        'uid' => array(
          'uid',
        ),
      ),
      'primary key' => array(
        'pid',
      ),
    ),
    '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',
      ),
      'foreign keys' => array(
        'password_policy' => array(
          'table' => 'password_policy',
          'columns' => array(
            'pid' => 'pid',
          ),
        ),
        'role' => array(
          'table' => 'role',
          'columns' => array(
            'rid' => 'rid',
          ),
        ),
      ),
      '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,
        ),
      ),
      'foreign keys' => array(
        'user' => array(
          'table' => 'users',
          'columns' => array(
            'uid' => 'uid',
          ),
        ),
      ),
      'indexes' => array(
        'uid' => array(
          'uid',
        ),
      ),
      'primary key' => array(
        'uid',
      ),
    ),
    'password_policy_role' => array(
      'description' => 'Links policies with roles.',
      'fields' => array(
        'pid' => array(
          'description' => 'Policy ID.',
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'rid' => array(
          'description' => 'Role ID.',
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
      ),
      'foreign keys' => array(
        'password_policy' => array(
          'table' => 'password_policy',
          'columns' => array(
            'pid' => 'pid',
          ),
        ),
        'role' => array(
          'table' => 'role',
          'columns' => array(
            'rid' => 'rid',
          ),
        ),
      ),
      'primary key' => array(
        'rid',
        'pid',
      ),
    ),
    'password_policy_excluded_authentication_modules' => array(
      'description' => 'Authentication modules to be excluded from specified policies.',
      'fields' => array(
        'pid' => array(
          'description' => 'Policy ID.',
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'module' => array(
          'description' => 'Module.',
          'type' => 'varchar',
          'length' => 128,
          'not null' => TRUE,
          'default' => '',
        ),
      ),
      'foreign keys' => array(
        'password_policy' => array(
          'table' => 'password_policy',
          'columns' => array(
            'pid' => 'pid',
          ),
        ),
        'module' => array(
          'table' => 'authmap',
          'columns' => array(
            'module' => 'module',
          ),
        ),
      ),
      'primary key' => array(
        'module',
        'pid',
      ),
    ),
  );
}