You are here

function simpleads_schema in SimpleAds 7.2

Same name and namespace in other branches
  1. 8 simpleads.install \simpleads_schema()
  2. 7 simpleads.install \simpleads_schema()

Implements hook_schema().

File

./simpleads.install, line 635
SimpleAds module install.

Code

function simpleads_schema() {
  $schema['simpleads_impressions'] = array(
    'description' => 'Advertisement impressions',
    'fields' => array(
      'aid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Advertisement ID',
      ),
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Node ID',
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Timestamp',
      ),
      'ip_address' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'IP Address',
      ),
      'url' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Website URL',
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'indexes' => array(
      'aid' => array(
        'aid',
      ),
      'nid' => array(
        'nid',
      ),
    ),
  );
  $schema['simpleads_clicks'] = array(
    'description' => 'Advertisement clicks',
    'fields' => array(
      'aid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Advertisement ID',
      ),
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Node ID',
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Timestamp',
      ),
      'ip_address' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'IP address',
      ),
      'url' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Website URL',
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'indexes' => array(
      'aid' => array(
        'aid',
      ),
      'nid' => array(
        'nid',
      ),
    ),
  );
  $schema['simpleads_stats'] = array(
    'description' => 'Advertisement aggregated stats',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Advertisement node ID',
      ),
      'date' => array(
        'type' => 'int',
        'not null' => FALSE,
        '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',
    ),
  );
  $schema['simpleads_blocks'] = array(
    'description' => 'Advertisement blocks',
    'fields' => array(
      'bid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Advertisement block ID',
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Block machine name',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Block administrative name',
      ),
      'view_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'View name',
      ),
      'view_display_id' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'View display id',
      ),
      'settings' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Serialized data (settings)',
      ),
    ),
    'primary key' => array(
      'bid',
    ),
    'indexes' => array(
      'bid' => array(
        'bid',
      ),
    ),
  );
  return $schema;
}