You are here

function quotes_schema in Quotes 6

Same name and namespace in other branches
  1. 7 quotes.install \quotes_schema()

Implementation of hook_schema().

File

./quotes.install, line 18
Handles installation and updates for the quotes module.

Code

function quotes_schema() {
  $schema = array();
  $schema['quotes'] = array(
    'module' => 'Quotes',
    'description' => t('Extra node data.'),
    'fields' => array(
      'nid' => array(
        'description' => t('Node identifier.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'disp-width' => '10',
      ),
      'vid' => array(
        'description' => t('Version identifier.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'disp-width' => '10',
      ),
      'aid' => array(
        'description' => t('Author identifier.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'disp-width' => '10',
      ),
      'citation' => array(
        'description' => t('Source of the quote.'),
        'type' => 'text',
        'not null' => FALSE,
      ),
      'promote' => array(
        'description' => t('Status.'),
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'vid',
    ),
    'indexes' => array(
      'quotes_nid' => array(
        'nid',
      ),
      'quotes_promote' => array(
        'promote',
      ),
      'quotes_aid' => array(
        'aid',
      ),
    ),
  );
  $schema['quotes_blocks'] = array(
    'module' => 'Quotes',
    'description' => t('Quotes blocks data.'),
    'fields' => array(
      'bid' => array(
        'description' => t('Block number'),
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'block_type' => array(
        'description' => t('Type of block'),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'vid' => array(
        'description' => t('Version id'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'count' => array(
        'description' => t('Number of quotes in the block.'),
        'type' => 'int',
        'not null' => FALSE,
        'default' => 1,
      ),
      'cron_interval' => array(
        'description' => t('Cron frequency'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'cron_step' => array(
        'description' => t('Cron step'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'cron_last' => array(
        'description' => t('Last Cron run time'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'show_titles' => array(
        'description' => t('Show titles.'),
        'type' => 'int',
        'size' => 'small',
        'not null' => FALSE,
        'default' => 0,
        'disp-width' => '6',
      ),
      'show_citation' => array(
        'description' => t('Show citation.'),
        'type' => 'int',
        'size' => 'small',
        'not null' => FALSE,
        'default' => 0,
      ),
      'max_length' => array(
        'description' => t('Maximum length of quote in block.'),
        'type' => 'int',
        'not null' => FALSE,
        'default' => 0,
        'disp-width' => '11',
      ),
      'rand_freq' => array(
        'description' => t('Display frequency for random blocks.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 100,
      ),
      /* Removed by http://drupal.org/node/601434.
         'view_weight' => array(
           'description' => t('Weight for the view link.'),
           'type' => 'int',
           'size' => 'small',
           'not null' => FALSE,
           'default' => 1,
           ), /* */
      'name' => array(
        'description' => t('Name of this block'),
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
      ),
      'nid_filter' => array(
        'description' => t('Node filter'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'aid_filter' => array(
        'description' => t('Author filter'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'rid_filter' => array(
        'description' => t('Role filter'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'uid_filter' => array(
        'description' => t('User filter'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'tid_filter' => array(
        'description' => t('Term filter'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'view_text' => array(
        'description' => t('Text for the "view" link.'),
        'type' => 'varchar',
        'length' => 64,
        'not null' => FALSE,
      ),
      'more_text' => array(
        'description' => t('Text for the "more" link.'),
        'type' => 'varchar',
        'length' => 64,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'bid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  $schema['quotes_authors'] = array(
    'module' => 'Quotes',
    'description' => t('Quotes authors data.'),
    'fields' => array(
      'aid' => array(
        'description' => t('Author identifier.'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'disp-width' => '10',
      ),
      'name' => array(
        'description' => t('Author of the quote.'),
        'type' => 'text',
        'not null' => TRUE,
      ),
      'bio' => array(
        'description' => t("Author's biography."),
        'type' => 'text',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'unique keys' => array(
      'name' => array(
        array(
          'name',
          255,
        ),
      ),
    ),
  );
  return $schema;
}