You are here

function simplenews_statistics_schema in Simplenews Statistics 6.3

Same name and namespace in other branches
  1. 6 simplenews_statistics.install \simplenews_statistics_schema()
  2. 6.2 simplenews_statistics.install \simplenews_statistics_schema()
  3. 7.2 simplenews_statistics.install \simplenews_statistics_schema()
  4. 7 simplenews_statistics.install \simplenews_statistics_schema()

Implements hook_schema().

File

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

Code

function simplenews_statistics_schema() {
  $schema['simplenews_statistics'] = array(
    'description' => 'Statistics',
    'fields' => array(
      'nid' => array(
        'description' => 'Node ID.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'send' => array(
        'description' => 'Send emails for this newsletter',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'total_clicks' => array(
        'description' => 'Total clicks for this newsletter',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'total_opens' => array(
        'description' => 'Total opens for this newsletter',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'unique_opens' => array(
        'description' => 'Emailaddress-unique opens for this newsletter',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'user_unique_click_through' => array(
        'description' => 'Number of users who have clicked at least one link in the newsletter',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['simplenews_statistics_clicks'] = array(
    'description' => 'Newsletter Clicks',
    'fields' => array(
      'email' => array(
        'description' => 'Primary key: Email.',
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 255,
        'default' => '',
      ),
      'nid' => array(
        'description' => 'Node ID.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'url' => array(
        'description' => 'The clicked URL.',
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 255,
        'default' => '',
      ),
      'timestamp' => array(
        'description' => 'The time of the click',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
  );
  $schema['simplenews_statistics_opens'] = array(
    'description' => 'Newsletter Opens',
    'fields' => array(
      'email' => array(
        'description' => 'Primary key: Email.',
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 255,
        'default' => '',
      ),
      'nid' => array(
        'description' => 'Node ID.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'timestamp' => array(
        'description' => 'Time of view',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
  );
  return $schema;
}