function security_questions_schema in Security Questions 6.2
Same name and namespace in other branches
- 6 security_questions.install \security_questions_schema()
- 7.2 security_questions.install \security_questions_schema()
- 7 security_questions.install \security_questions_schema()
Implements hook_schema().
File
- ./
security_questions.install, line 10 - Install file for security_questions.
Code
function security_questions_schema() {
$schema = array();
$schema['security_questions_answers'] = array(
'description' => 'Contains users security question answers.',
'fields' => array(
'uid' => array(
'description' => 'The user ID.',
'type' => 'int',
'not null' => TRUE,
),
'sqid' => array(
'description' => 'The security question ID',
'type' => 'int',
),
'answer' => array(
'description' => 'The answer to the users question',
'type' => 'varchar',
'length' => '100',
),
),
'primary key' => array(
'uid',
'sqid',
),
);
$schema['security_questions'] = array(
'description' => 'Contains possible security questions',
'fields' => array(
'sqid' => array(
'description' => 'The security question ID',
'type' => 'serial',
),
'question' => array(
'description' => 'The text of the question',
'type' => 'varchar',
'length' => '500',
),
'uid' => array(
'description' => '0 for questions available system-wide, or the owning uid for custom per-user questions.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'machine_name' => array(
'description' => 'An optional machine-readable name for this question, to support exportable configuration.',
'type' => 'varchar',
'length' => 255,
),
),
'primary key' => array(
'sqid',
),
'indexes' => array(
'uid' => array(
'uid',
),
),
);
$schema['security_questions_incorrect'] = array(
'description' => 'Tracks incorrect answer attempts by IP.',
'fields' => array(
'aid' => array(
'description' => 'Unique attempt ID.',
'type' => 'serial',
'not null' => TRUE,
),
'sqid' => array(
'description' => 'The security question ID.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => 'The user ID.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'ip' => array(
'description' => 'The IP address of the visitor that attempted to answer the question as the user.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'timestamp' => array(
'description' => 'Timestamp of the failed attempt.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'expiration' => array(
'description' => 'Expiration timestamp. Expired attempts are purged on cron run.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'aid',
),
'indexes' => array(
'uid_ip' => array(
'uid',
'ip',
),
'expire' => array(
'expiration',
),
),
);
return $schema;
}