You are here

function simpleads_update_7006 in SimpleAds 7

Create SimpleAds aggregated stats table.

File

./simpleads.updates.inc, line 625
SimpleAds Updates.

Code

function simpleads_update_7006(&$sandbox) {
  $schema['simpleads_stats'] = array(
    'description' => 'Advertisement aggregated stats',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Advertisement node ID',
      ),
      'date' => array(
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Stats day',
      ),
      'clicks' => array(
        'type' => 'int',
        'not null' => FALSE,
        'description' => 'Clicks counter',
      ),
      'clicks_unique' => array(
        'type' => 'int',
        'not null' => FALSE,
        'description' => 'Clicks counter',
      ),
      'impressions' => array(
        'type' => 'int',
        'not null' => FALSE,
        'description' => 'Impressions counter',
      ),
      'impressions_unique' => array(
        'type' => 'int',
        'not null' => FALSE,
        'description' => 'Impressions counter',
      ),
    ),
    'primary key' => array(
      'nid',
      'date',
    ),
  );
  db_create_table('simpleads_stats', $schema['simpleads_stats']);
}