You are here

function nodequeue_schema in Nodequeue 6.2

Same name and namespace in other branches
  1. 7.3 nodequeue.install \nodequeue_schema()
  2. 7.2 nodequeue.install \nodequeue_schema()

Implementation of hook_schema().

File

./nodequeue.install, line 11
Install, update and uninstall functions for the nodequeue module.

Code

function nodequeue_schema() {
  $schema['nodequeue_queue'] = array(
    'description' => 'Base table for queues, storing global information for each queue',
    'fields' => array(
      'qid' => array(
        'description' => 'The primary identifier for a queue.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'The machine name for the queue',
        'type' => 'varchar',
        'length' => 128,
      ),
      'title' => array(
        'description' => 'Title of a queue.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'subqueue_title' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'size' => array(
        'description' => 'How many nodes this queue will hold',
        'type' => 'int',
        'default' => 0,
      ),
      'link' => array(
        'description' => 'The link text to show under a node to add it to the queue.',
        'type' => 'varchar',
        'length' => 40,
      ),
      'link_remove' => array(
        'description' => 'The link text to show under a node to remove it from the queue.',
        'type' => 'varchar',
        'length' => 40,
      ),
      'owner' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => 255,
      ),
      'show_in_ui' => array(
        'description' => '',
        'type' => 'int',
        'size' => 'tiny',
        'default' => 1,
      ),
      'show_in_tab' => array(
        'description' => '',
        'type' => 'int',
        'size' => 'tiny',
        'default' => 1,
      ),
      'show_in_links' => array(
        'description' => '',
        'type' => 'int',
        'size' => 'tiny',
        'default' => 1,
      ),
      'reference' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => 255,
        'default' => '0',
      ),
      'reverse' => array(
        'description' => '',
        'type' => 'int',
        'size' => 'tiny',
        'default' => 0,
      ),
      'i18n' => array(
        'description' => '',
        'type' => 'int',
        'size' => 'tiny',
        'default' => 1,
      ),
    ),
    // fields
    'primary key' => array(
      'qid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );

  // nodequeue_queue.
  $schema['nodequeue_roles'] = array(
    'description' => 'Defines the roles which are allowed to use a particular nodequeue.',
    'fields' => array(
      'qid' => array(
        'description' => 'Primary key for {nodequeue_queue}',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'rid' => array(
        'description' => 'Primary key for roles',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    // fields
    'indexes' => array(
      'qid' => array(
        'qid',
      ),
      'rid' => array(
        'rid',
      ),
    ),
  );

  // nodequeue_roles
  $schema['nodequeue_types'] = array(
    'description' => 'Defines the node types which are allowed in each queue',
    'fields' => array(
      'qid' => array(
        'description' => 'Primary key for {nodequeue_queue}',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'type' => array(
        'description' => 'Node Type',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    // fields
    'indexes' => array(
      'qid' => array(
        'qid',
      ),
      'type' => array(
        'type',
      ),
    ),
  );

  // nodequeue_types
  // Subqueues are minor queues that inherit all of the properties of
  // the parent queue. A parent queue must have at least 1 subqueue
  // to do anything. Reference is for the use of whatever is creating
  // the subqueues in order to link it to some other ID easily.
  $schema['nodequeue_subqueue'] = array(
    'description' => 'Subqueues are minor queues that inherit all of the properties of the parent queue. A parent queue must have at least 1 subqueue to do anything. Reference is for the use of whatever is creating the subqueues in order to link it to some other ID easily.',
    'fields' => array(
      'sqid' => array(
        'description' => 'Subqueue identifier',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'qid' => array(
        'description' => 'Queue identifier.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'reference' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => 255,
        'default' => '0',
        'not null' => FALSE,
      ),
      'title' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => 255,
        'default' => '',
        'not null' => FALSE,
      ),
    ),
    // fields
    'primary key' => array(
      'sqid',
    ),
    'indexes' => array(
      'qid' => array(
        'qid',
      ),
      'reference' => array(
        'reference',
      ),
      'title' => array(
        'title',
      ),
    ),
  );

  // nodequeue_subqueue
  $schema['nodequeue_nodes'] = array(
    'description' => 'Indicates which nodes are in which queues/subqueues.',
    'fields' => array(
      'qid' => array(
        'description' => 'Queue id',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'sqid' => array(
        'description' => 'Subqueue this node is in',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nid' => array(
        'description' => 'Node id in this subqueue',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'position' => array(
        'description' => 'The position of the node in this subqueue.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'timestamp' => array(
        'description' => "The time that the item's position in the subqueue was updated.",
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    // fields
    'indexes' => array(
      'sqid' => array(
        'sqid',
        'position',
      ),
      'nid' => array(
        'nid',
      ),
      'qid_nid' => array(
        'qid',
        'nid',
      ),
    ),
  );

  // nodequeue_nodes
  return $schema;
}