You are here

function search_log_schema in Search Log 7

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

Implements hook_schema().

File

./search_log.install, line 11
Install file for Search log.

Code

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