forum_schema

6 forum.install forum_schema()
7 forum.install forum_schema()
8 forum.install forum_schema()

Implements hook_schema().

File

modules/forum/forum.install, line 126
Install, update and uninstall functions for the forum module.

Code

function forum_schema() {
  $schema['forum'] = array(
    'description' => 'Stores the relationship of nodes to forum terms.', 
    'fields' => array(
      'nid' => array(
        'type' => 'int', 
        'unsigned' => TRUE, 
        'not null' => TRUE, 
        'default' => 0, 
        'description' => 'The {node}.nid of the node.',
      ), 
      'vid' => array(
        'type' => 'int', 
        'unsigned' => TRUE, 
        'not null' => TRUE, 
        'default' => 0, 
        'description' => 'Primary Key: The {node}.vid of the node.',
      ), 
      'tid' => array(
        'type' => 'int', 
        'unsigned' => TRUE, 
        'not null' => TRUE, 
        'default' => 0, 
        'description' => 'The {taxonomy_term_data}.tid of the forum term assigned to the node.',
      ),
    ), 
    'indexes' => array(
      'forum_topic' => array('nid', 'tid'), 
      'tid' => array('tid'),
    ), 
    'primary key' => array('vid'), 
    'foreign keys' => array(
      'forum_node' => array(
        'table' => 'node', 
        'columns' => array(
          'nid' => 'nid', 
          'vid' => 'vid',
        ),
      ),
    ),
  );

  $schema['forum_index'] = array(
    'description' => 'Maintains denormalized information about node/term relationships.', 
    'fields' => array(
      'nid' => array(
        'description' => 'The {node}.nid this record tracks.', 
        'type' => 'int', 
        'unsigned' => TRUE, 
        'not null' => TRUE, 
        'default' => 0,
      ), 
      'title' => array(
        'description' => 'The title of this node, always treated as non-markup plain text.', 
        'type' => 'varchar', 
        'length' => 255, 
        'not null' => TRUE, 
        'default' => '',
      ), 
      'tid' => array(
        'description' => 'The term ID.', 
        'type' => 'int', 
        'unsigned' => TRUE, 
        'not null' => TRUE, 
        'default' => 0,
      ), 
      'sticky' => array(
        'description' => 'Boolean indicating whether the node is sticky.', 
        'type' => 'int', 
        'not null' => FALSE, 
        'default' => 0, 
        'size' => 'tiny',
      ), 
      'created' => array(
        'description' => 'The Unix timestamp when the node was created.', 
        'type' => 'int', 
        'unsigned' => TRUE, 
        'not null' => TRUE, 
        'default' => 0,
      ), 
      'last_comment_timestamp' => array(
        'type' => 'int', 
        'not null' => TRUE, 
        'default' => 0, 
        'description' => 'The Unix timestamp of the last comment that was posted within this node, from {comment}.timestamp.',
      ), 
      'comment_count' => array(
        'type' => 'int', 
        'unsigned' => TRUE, 
        'not null' => TRUE, 
        'default' => 0, 
        'description' => 'The total number of comments on this node.',
      ),
    ), 
    'indexes' => array(
      'forum_topics' => array('nid', 'tid', 'sticky', 'last_comment_timestamp'),
    ), 
    'foreign keys' => array(
      'tracked_node' => array(
        'table' => 'node', 
        'columns' => array('nid' => 'nid'),
      ), 
      'term' => array(
        'table' => 'taxonomy_term_data', 
        'columns' => array(
          'tid' => 'tid',
        ),
      ),
    ),
  );


  return $schema;
}
Login or register to post comments