You are here

function simplenews_statistics_update_7002 in Simplenews Statistics 7.2

Same name and namespace in other branches
  1. 7 simplenews_statistics.install \simplenews_statistics_update_7002()

Create new fields for storing aggregated totals for archived newsletters.

File

./simplenews_statistics.install, line 267
Simplenews statistics (un)install and updates file.

Code

function simplenews_statistics_update_7002() {
  $fields = array(
    'archived' => array(
      'description' => '0 = active; 1 = archived.',
      'type' => 'int',
      'not null' => TRUE,
      'default' => 0,
    ),
    'unique_opens' => array(
      'description' => 'Unique open count if newsletter is archived.',
      'type' => 'int',
      'not null' => TRUE,
      'default' => -1,
    ),
    'total_opens' => array(
      'description' => 'Total open count if newsletter is archived.',
      'type' => 'int',
      'not null' => TRUE,
      'default' => -1,
    ),
    'unique_clicks' => array(
      'description' => 'Unique click count if newsletter is archived.',
      'type' => 'int',
      'not null' => TRUE,
      'default' => -1,
    ),
    'click_count' => array(
      'description' => 'Aggregated click count if newsletter is archived.',
      'type' => 'int',
      'not null' => TRUE,
      'default' => -1,
    ),
  );
  db_add_field('simplenews_statistics', 'archived', $fields['archived']);
  db_add_field('simplenews_statistics', 'unique_opens', $fields['unique_opens']);
  db_add_field('simplenews_statistics', 'total_opens', $fields['total_opens']);
  db_add_field('simplenews_statistics', 'unique_clicks', $fields['unique_clicks']);
  db_add_field('simplenews_statistics_url', 'click_count', $fields['click_count']);
}