You are here

function simplenews_statistics_schema in Simplenews Statistics 6

Same name and namespace in other branches
  1. 6.3 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()

Implementation of hook_schema().

File

./simplenews_statistics.install, line 12
Simplenews Statistics installation.

Code

function simplenews_statistics_schema() {
  $schema['simplenews_statistics'] = array(
    'description' => t('Statistics'),
    'fields' => array(
      'nid' => array(
        'description' => t('Node ID.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'send' => array(
        'description' => t('Send emails'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['simplenews_statistics_clicks'] = array(
    'description' => t('Newsletter Clicks'),
    'fields' => array(
      'email' => array(
        'description' => t('Primary key: Email.'),
        'type' => 'varchar',
        'not null' => TRUE,
        'default' => 0,
        'length' => 255,
      ),
      'nid' => array(
        'description' => t('Node ID.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'url' => array(
        'description' => t('The clicked URL.'),
        'type' => 'varchar',
        'not null' => TRUE,
        'default' => 0,
        'length' => 255,
      ),
      'timestamp' => array(
        'description' => t('The time of the click'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
  );
  $schema['simplenews_statistics_opens'] = array(
    'description' => t('Newsletter Opens'),
    'fields' => array(
      'email' => array(
        'description' => t('Primary key: Email.'),
        'type' => 'varchar',
        'not null' => TRUE,
        'default' => 0,
        'length' => 255,
      ),
      'nid' => array(
        'description' => t('Node ID.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'opens' => array(
        'description' => t('Amount of opens'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'timestamp' => array(
        'description' => t('Time of view'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
  );
  return $schema;
}