You are here

function captcha_questions_dblog_schema in Captcha Questions 8

Same name and namespace in other branches
  1. 7 captcha_questions_dblog/captcha_questions_dblog.install \captcha_questions_dblog_schema()

Implements hook_schema().

File

captcha_questions_dblog/captcha_questions_dblog.install, line 14
Install and uninstall functions for the Captcha questions dblog module.

Code

function captcha_questions_dblog_schema() {
  $schema['captcha_questions_dblog'] = [
    'description' => 'Stores failed form submissions.',
    'fields' => [
      'dblogid' => [
        'description' => 'Primary Key: unique ID for failed form submissions.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'timestamp' => [
        'description' => 'A Unix timestamp indicating when the submit failed.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'ip' => [
        'description' => 'IP address',
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
      ],
      'form_id' => [
        'description' => 'The form_id of the form',
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
      ],
      'question_asked' => [
        'description' => 'The question the form submit failed on',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'answer_given' => [
        'description' => 'The answer that was wrong',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'answer_correct' => [
        'description' => 'The correct answer',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
    ],
    'indexes' => [
      'dblogid' => [
        'dblogid',
      ],
      'timestamp' => [
        'timestamp',
      ],
    ],
  ];
  return $schema;
}