You are here

function security_questions_update_7201 in Security Questions 7.2

Add the security_questions_incorrect table.

File

./security_questions.install, line 157
Install file for security_questions.

Code

function security_questions_update_7201() {
  $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,
      ),
      'security_question_id' => 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',
      ),
    ),
  );
  db_create_table('security_questions_incorrect', $schema['security_questions_incorrect']);
}