You are here

function search_log_schema in Search Log 8

Same name and namespace in other branches
  1. 6 search_log.install \search_log_schema()
  2. 7 search_log.install \search_log_schema()

Implements hook_schema().

File

./search_log.install, line 15
Install file for the Search log module.

Code

function search_log_schema() {
  $schema['search_log'] = [
    'description' => 'Log of search terms.',
    'fields' => [
      'qid' => [
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Auto-incrementing query ID.',
      ],
      'q' => [
        'description' => 'Query string.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'module' => [
        'description' => 'Module implementing search.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'language' => [
        'description' => 'Language of the query.',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ],
      'day' => [
        'description' => 'Day query was performed.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'counter' => [
        'description' => 'Number of times query performed on day.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'medium',
      ],
      'result' => [
        'description' => 'Indicator of failed or successful query.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'qid',
    ],
    'unique keys' => [
      'q_mod_day' => [
        'q',
        'module',
        'day',
      ],
    ],
    'indexes' => [
      'mod' => [
        'module',
      ],
      'day' => [
        'day',
      ],
    ],
  ];
  return $schema;
}