You are here

yandex_metrics_reports.install in Yandex.Metrics 8.2

Install, uninstall and update the module.

File

yandex_metrics_reports/yandex_metrics_reports.install
View source
<?php

/**
 * @file
 * Install, uninstall and update the module.
 */

/**
 * Implements hook_uninstall().
 */
function yandex_metrics_reports_uninstall() {

  // Delete module variables and clear variables cache.
  db_delete('variable')
    ->condition('name', 'yandex_metrics_reports_%', 'LIKE')
    ->execute();
  cache_clear_all('variables', 'cache_bootstrap');
}

/**
 * Implements hook_schema().
 */
function yandex_metrics_reports_schema() {
  $schema['yandex_metrics_reports_popular_content'] = array(
    'description' => 'Stores the popular content.',
    'fields' => array(
      'yid' => array(
        'description' => 'The id for url.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'url' => array(
        'description' => 'The url obtained from Yandex.metrika.',
        'type' => 'varchar',
        'length' => 2048,
        'not null' => TRUE,
        'default' => '',
      ),
      'language' => array(
        'description' => 'Language of the page.',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ),
      'page_title' => array(
        'description' => 'The page title of the url.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'page_views' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Page views of this url.',
      ),
    ),
    'primary key' => array(
      'yid',
    ),
    'indexes' => array(
      'language' => array(
        'language',
      ),
      'url' => array(
        array(
          'url',
          255,
        ),
      ),
    ),
  );
  return $schema;
}