You are here

function ga_stats_schema in Google Analytics Statistics 7.x

Same name and namespace in other branches
  1. 7.2 ga_stats.install \ga_stats_schema()
  2. 7 ga_stats.install \ga_stats_schema()

Implementation of hook_schema()

create tables ga_stats_metrics and ga_stats_count

File

./ga_stats.install, line 7

Code

function ga_stats_schema() {
  $schema = array();
  $schema['ga_stats_count'] = array(
    'description' => 'Stores counts for different metics',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => FALSE,
        'description' => 'nid of related node',
      ),
      'url' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
        'description' => 'url of page',
      ),
      'metric' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
        'description' => 'name of metric',
      ),
      'timeframe' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
        'description' => 'timeframe of metric',
      ),
      'count' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'number of reads',
      ),
    ),
    'indexes' => array(
      'ga_stats_metric' => array(
        'metric',
      ),
      'ga_stats_timeframe' => array(
        'timeframe',
      ),
      'ga_stats_nid' => array(
        'nid',
      ),
    ),
  );
  return $schema;
}