You are here

function faq_schema in Frequently Asked Questions 6

Same name and namespace in other branches
  1. 8 faq.install \faq_schema()
  2. 7.2 faq.install \faq_schema()
  3. 7 faq.install \faq_schema()

Define the 'faq_weights' and 'faq_questions' table structures.

Return value

The schema which contains the structure for the faq module's tables.

File

./faq.install, line 14
FAQ module install file.

Code

function faq_schema() {
  $schema['faq_weights'] = array(
    'description' => 'A table containing the weight of each faq node by category.',
    'fields' => array(
      'tid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The primary identifier for a term or category.  This will be 0 for non-categorized nodes.',
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The primary identifier for a node.',
      ),
      'weight' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'A number representing the weight of a node.  Nodes with lower weight values will appear above those with higher weight values.',
      ),
    ),
    'primary key' => array(
      'nid',
      'tid',
    ),
  );
  $schema['faq_questions'] = array(
    'description' => 'A table containing the long question text of each faq node revision.',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The primary identifier for a node.',
      ),
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The primary identifier for a node revision.',
      ),
      'question' => array(
        'type' => 'text',
        'size' => 'normal',
        'not null' => TRUE,
        'description' => 'The faq short question text.',
      ),
      'detailed_question' => array(
        'type' => 'text',
        'size' => 'normal',
        'not null' => TRUE,
        'description' => 'The faq long question text.',
      ),
    ),
    'primary key' => array(
      'nid',
      'vid',
    ),
  );
  return $schema;
}