You are here

function simplenews_statistics_update_7001 in Simplenews Statistics 7

Same name and namespace in other branches
  1. 7.2 simplenews_statistics.install \simplenews_statistics_update_7001()

Create new database table {simplenews_statistics}.

File

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

Code

function simplenews_statistics_update_7001() {
  $schema['simplenews_statistics'] = array(
    'description' => 'Additional fields for {simplenews_newsletter}.',
    'fields' => array(
      'nid' => array(
        'description' => 'The {simplenews_newsletter}.nid.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'subscriber_count' => array(
        'description' => 'The count of subscribers at the time of sending.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'send_start_timestamp' => array(
        'description' => 'The timestamp that newsletter sending started.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'send_end_timestamp' => array(
        'description' => 'The timestamp that the last newsletter was sent.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
    'foreign keys' => array(
      'nid' => array(
        'table' => 'simplenews_newsletter',
        'columns' => array(
          'nid' => 'nid',
        ),
      ),
    ),
  );
  db_create_table('simplenews_statistics', $schema['simplenews_statistics']);
}