You are here

function kwresearch_schema in Keyword Research 6

Same name and namespace in other branches
  1. 7 kwresearch.install \kwresearch_schema()

Implementation of hook_schema

File

./kwresearch.install, line 28
Install hooks for Keyword Research.

Code

function kwresearch_schema() {
  $schema['kwresearch_keyword'] = array(
    'description' => 'Creates database table to store keyword data.',
    'fields' => array(
      'kid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The id for the keyword.',
      ),
      //kid
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'description' => 'The id for the user.',
      ),
      //uid
      'keyword' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'subject keyword.',
      ),
      //keyword
      'word_count' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
        'description' => 'number of words in phrase',
      ),
      //word_count
      'priority' => array(
        'type' => 'int',
        'size' => 'tiny',
        //'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => -1,
        'description' => 'importance of word to site',
      ),
      //priority
      'value' => array(
        'type' => 'float',
        //'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => -1,
        'description' => 'value of word to site',
      ),
      //value
      'page_count' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'number of pages with keyword assocated',
      ),
      //page_count
      'stats_update' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'description' => 'timestamp of last data update',
      ),
      //stats_update
      'daily_volume' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'description' => 'estimated times the keyword is searched on major search engines per day',
      ),
      //daily_volume
      'bid' => array(
        'type' => 'float',
        //'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => -1,
        'description' => 'recommended bid price for keyword phrase',
      ),
      //value
      'competition' => array(
        'type' => 'int',
        'size' => 'tiny',
        //'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => -1,
        'description' => 'level of competition for the keyword phrase',
      ),
    ),
    'primary key' => array(
      'kid',
    ),
    'indexes' => array(
      'keyword' => array(
        'keyword',
      ),
      'priority' => array(
        'priority',
      ),
    ),
  );
  $schema['kwresearch_page_keyword'] = array(
    'description' => 'Creates database table to store page keyword data.',
    'fields' => array(
      'kid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The id for the keyword.',
      ),
      //kid
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'description' => 'The id for the node.',
      ),
      //nid
      'path' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
        'description' => 'path to page.',
      ),
      //path
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'description' => 'The id for the user.',
      ),
      //uid
      'priority' => array(
        'type' => 'int',
        'size' => 'tiny',
        //'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => -1,
        'description' => 'importance of word to site',
      ),
    ),
    'indexes' => array(
      'kid' => array(
        'kid',
      ),
      'nid' => array(
        'nid',
      ),
      'path' => array(
        'path',
      ),
    ),
  );
  return $schema;
}