function password_policy_schema in Password Policy 7.2
Same name and namespace in other branches
- 6 password_policy.install \password_policy_schema()
- 7 password_policy.install \password_policy_schema()
Implements hook_schema().
File
- ./
password_policy.install, line 11 - Install functions for Password Policy module.
Code
function password_policy_schema() {
$schema['password_policy'] = array(
'description' => 'Table storing Password Policies.',
'export' => array(
'key' => 'name',
'key name' => 'Name',
'primary key' => 'name',
// Exports will be as $myobj.
'identifier' => 'password_policy',
// Function hook name.
'default hook' => 'default_password_policy',
'api' => array(
'owner' => 'password_policy',
// Base name for api include files.
'api' => 'default_password_policy',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'name' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'description' => 'Unique ID for a Password Policy.',
),
'config' => array(
'type' => 'text',
'not null' => FALSE,
'description' => 'Configuration for Password Policy',
'size' => 'big',
),
),
'primary key' => array(
'name',
),
);
$schema['password_policy_history'] = array(
'description' => 'Stores user\'s old password hashes.',
'fields' => array(
'hid' => array(
'description' => 'Primary Key: Unique history ID.',
'type' => 'serial',
'unsigned' => TRUE,
'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,
),
'is_generated' => array(
'description' => 'Boolean indicating whether the password is generated.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'foreign keys' => array(
'password_policy' => array(
'table' => 'password_policy',
'columns' => array(
'name' => 'name',
),
),
'user' => array(
'table' => 'users',
'columns' => array(
'uid' => 'uid',
),
),
),
'indexes' => array(
'uid' => array(
'uid',
),
),
'primary key' => array(
'hid',
),
);
$schema['password_policy_notice_history'] = array(
'description' => 'Recorded when notices are sent',
'fields' => array(
'nhid' => array(
'description' => 'Primary Key: Unique notice history ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'hid' => array(
'description' => 'Password history id.',
'type' => 'int',
'not null' => TRUE,
),
'name' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Policy name.',
),
'timeframe' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Timeframe instruction when sent',
),
'sent' => array(
'description' => 'Timestamp for when notice was sent.',
'type' => 'int',
'not null' => TRUE,
),
),
'foreign keys' => array(
'password_policy' => array(
'table' => 'password_policy',
'columns' => array(
'name' => 'name',
),
),
'password_policy_history' => array(
'table' => 'password_policy_history',
'columns' => array(
'hid' => 'hid',
),
),
),
'indexes' => array(
'timeframe' => array(
'timeframe',
),
),
'primary key' => array(
'nhid',
),
);
return $schema;
}