You are here

function ad_schema in Advertisement 7.2

Same name and namespace in other branches
  1. 6.3 ad.install \ad_schema()
  2. 6 ad.install \ad_schema()
  3. 6.2 ad.install \ad_schema()
  4. 7.3 ad.install \ad_schema()
  5. 7 ad.install \ad_schema()

Implements hook_schema().

File

./ad.install, line 21

Code

function ad_schema() {
  $schema = array();
  $schema['ad'] = array(
    'description' => 'The base table for ads.',
    'fields' => array(
      'aid' => array(
        'description' => 'The primary identifier for an advertisement, used internally only.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'type' => array(
        'description' => 'The {ad_type}.type of this advertisement.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'title' => array(
        'description' => 'The title of this advertisement, always treated as non-markup plain text.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'uid' => array(
        'description' => 'The {users}.uid that created this advertisement.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'description' => 'Workflow status of advertisement.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ),
      'created' => array(
        'description' => 'The Unix timestamp when the advertisement was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => 'The Unix timestamp when the advertisement was most recently saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'indexes' => array(
      'type' => array(
        'type',
      ),
    ),
    'foreign keys' => array(
      'uid' => array(
        'users' => 'uid',
      ),
    ),
  );
  $schema['ad_type'] = array(
    'description' => 'Stores information about all defined {ad} types.',
    'fields' => array(
      'type' => array(
        'description' => 'The machine-readable name of this type.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'name' => array(
        'description' => 'The human-readable name of this type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'A brief description of this type.',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'medium',
      ),
      'help' => array(
        'description' => 'Help information shown to the user when creating an {ad} of this type.',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'medium',
      ),
    ),
    'primary key' => array(
      'type',
    ),
  );
  return $schema;
}