You are here

function ad_channel_schema in Advertisement 6.2

Same name and namespace in other branches
  1. 6.3 channel/ad_channel.install \ad_channel_schema()
  2. 7 channel/ad_channel.install \ad_channel_schema()

Create the ad_channel schema.

File

channel/ad_channel.install, line 12

Code

function ad_channel_schema() {
  $schema['ad_channel'] = array(
    'description' => 'The ad_channel table allows advertisements to be organized into channels against which rules can be applied.',
    'fields' => array(
      'chid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => 'Unique channel ID.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The name of the channel.',
      ),
      'description' => array(
        'type' => 'text',
        'size' => 'big',
        'not null' => FALSE,
        'description' => 'A description of the channel.',
      ),
      'conid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'ID of the container the channel is in.',
      ),
      'weight' => array(
        'type' => 'int',
        'size' => 'medium',
        'not null' => TRUE,
        'unsigned' => FALSE,
        'default' => 0,
        'description' => 'Used when displaying channels to admins, heavier weights sink to the bottom.',
      ),
      'display' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'no_channel_percent' => array(
        'type' => 'int',
        'size' => 'medium',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'inventory' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'urls' => array(
        'type' => 'text',
      ),
      'groups' => array(
        'type' => 'text',
      ),
    ),
    'primary key' => array(
      'chid',
    ),
    'indexes' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  $schema['ad_channel_remnant'] = array(
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'remnant' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'aid',
      'remnant',
    ),
  );
  $schema['ad_channel_container'] = array(
    'description' => 'The ad_channel_container table stores channel container definitions.',
    'fields' => array(
      'conid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => 'Unique container ID.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The name of the container.',
      ),
      'description' => array(
        'type' => 'text',
        'size' => 'big',
        'not null' => FALSE,
        'description' => 'A description of the container.',
      ),
      'weight' => array(
        'type' => 'int',
        'size' => 'medium',
        'not null' => TRUE,
        'unsigned' => FALSE,
        'default' => 0,
        'description' => 'Used when displaying channels to admins, heavier weights sink to the bottom.',
      ),
    ),
    'primary key' => array(
      'conid',
    ),
  );
  $schema['ad_channel_node'] = array(
    'description' => 'The ad_channel_node table stores per node channel information.',
    'fields' => array(
      'chid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'chid',
      'nid',
    ),
    'indexes' => array(
      'nid_chid' => array(
        'nid',
        'chid',
      ),
    ),
  );
  $schema['ad_priority'] = array(
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'priority' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'aid',
      'priority',
    ),
  );
  return $schema;
}