You are here

function ad_owners_schema in Advertisement 6.2

Same name and namespace in other branches
  1. 6.3 owners/ad_owners.install \ad_owners_schema()
  2. 6 owners/ad_owners.install \ad_owners_schema()
  3. 7 owners/ad_owners.install \ad_owners_schema()

Implementation of hook_schema().

File

owners/ad_owners.install, line 14
Ad_owners module database schema.

Code

function ad_owners_schema() {
  $schema['ad_owners'] = array(
    'description' => 'Stores information about ad owners. Every ad can have one or more owners.',
    'fields' => array(
      'oid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => 'Unique owner pair ID.',
      ),
      'aid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'Ad id.',
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'The {users}.uid that owns ad.',
      ),
    ),
    'primary key' => array(
      'oid',
    ),
    'indexes' => array(
      'aid' => array(
        'aid',
      ),
      'uid' => array(
        'uid',
      ),
    ),
  );

  /**
   * Permissions can be granted to each owner of each ad.  The same owner
   * can own multiple ads, and can have different permissions for each ad.
   */
  $schema['ad_permissions'] = array(
    'description' => 'Permissions can be granted to each owner of each ad. The same owner can own multiple ads, and can have different permissions for each ad.',
    'fields' => array(
      'oid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => 'Owner pair ID.',
      ),
      'permissions' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'description' => 'Ad permission info.',
      ),
    ),
    'primary key' => array(
      'oid',
    ),
  );

  /**
   * The ad_hosts table is used to configure users that can display ads
   * remotely.
   */
  $schema['ad_hosts'] = array(
    'description' => 'The ad_hosts table is used to configure users that can display ads remotely. ',
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '',
      ),
      'hostid' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Host from which acion was made.',
      ),
      'status' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
        'description' => '',
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Host from which acion was made.',
      ),
    ),
    'primary key' => array(
      'uid',
    ),
    'indexes' => array(
      'status' => array(
        'status',
      ),
      'hostid' => array(
        'hostid',
      ),
    ),
  );
  return $schema;
}