You are here

function widgets_schema in Widgets 6

Same name and namespace in other branches
  1. 7 widgets.install \widgets_schema()

Implementation of hook_schema().

File

./widgets.install, line 10
Install, update and uninstall functions for the Widgets module.

Code

function widgets_schema() {
  $schema = array();

  // Definition for {widgets}.
  $schema['widgets'] = array(
    'description' => 'Base table for the Widgets module.',
    'fields' => array(
      'nid' => array(
        'description' => 'Node ID.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'widget_nid' => array(
        'description' => 'Widget node ID.',
        'type' => 'varchar',
        'length' => 45,
        'not null' => TRUE,
      ),
      'region' => array(
        'description' => 'Region. This will be implemented in later releases.',
        'type' => 'varchar',
        'length' => 45,
      ),
      'weight' => array(
        'description' => '',
        'type' => 'int',
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'widget_nid',
    ),
  );

  // Definition for {widgets_disabled}.
  $schema['widgets_status'] = array(
    'description' => 'Stores information on widget node status.',
    'fields' => array(
      'nid' => array(
        'description' => 'Node ID.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'disabled' => array(
        'description' => 'Widgets disabled for this node.',
        'type' => 'int',
        'size' => 'tiny',
        'default' => 0,
      ),
      'use_default' => array(
        'description' => 'Use default widgets for this node.',
        'type' => 'int',
        'size' => 'tiny',
        'default' => 1,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}