function widgets_schema in Widgets 7
Same name and namespace in other branches
- 6 widgets.install \widgets_schema()
Implements hook_schema().
File
- ./
widgets.install, line 11 - Install, update and uninstall functions for the widgets module.
Code
function widgets_schema() {
$schema = array();
$schema['cache_widgets'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_widgets']['description'] = 'Cache table used to store information about widgets manipulations that are in-progress.';
$schema['widgets_sets'] = array(
'description' => 'Stores configuration options for widget sets.',
'fields' => array(
'wsid' => array(
'description' => 'The primary identifier for a widget sets.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'The set name.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'data' => array(
'description' => 'The configuration data for the set.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array(
'wsid',
),
'unique keys' => array(
'name' => array(
'name',
),
),
// CTools exportable config.
'export' => array(
'key' => 'name',
'key name' => 'Name',
// Exports will be defined as $preset.
'identifier' => 'widgets_set',
// Function hook name.
'default hook' => 'default_widgets_set',
'api' => array(
'owner' => 'widgets',
// Base name for api include files.
'api' => 'widgets_set',
'minimum_version' => 1,
'current_version' => 1,
),
),
);
$schema['widgets_elements'] = array(
'description' => 'Stores configuration options for widgets.',
'fields' => array(
'weid' => array(
'description' => 'The primary identifier for an widgets.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'wsid' => array(
'description' => 'The {widgets_sets}.wsid for an widget style.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'weight' => array(
'description' => 'The weight of the effect in the style.',
'type' => 'int',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 0,
),
'name' => array(
'description' => 'The unique name of the effect to be executed.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'data' => array(
'description' => 'The configuration data for the element.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array(
'weid',
),
'indexes' => array(
'wsid' => array(
'wsid',
),
'weight' => array(
'weight',
),
),
);
$schema['widgets_definitions'] = array(
'description' => 'Stores data for widget definitions.',
'fields' => array(
'name' => array(
'description' => 'The definition name.',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'data' => array(
'description' => 'The configuration data for the element.',
'type' => 'blob',
'size' => 'big',
'not null' => TRUE,
),
),
'primary key' => array(
'name',
),
);
$schema['widgets_visibility'] = array(
'description' => 'Stores widget set and element visibility settings',
'fields' => array(
'wsid' => array(
'description' => 'widget set id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'weid' => array(
'description' => 'widget element id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'token' => array(
'description' => 'if widget available as token',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'block' => array(
'description' => 'if widget available as block',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'unique keys' => array(
'weid' => array(
'weid',
),
'wsid' => array(
'wsid',
),
),
);
$schema['widgets_visibility_type'] = array(
'description' => 'Stores widget visibility for content types',
'fields' => array(
'wsid' => array(
'description' => 'widget set id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'weid' => array(
'description' => 'widget element id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'type' => array(
'description' => 'content type',
'type' => 'varchar',
'length' => '32',
'not null' => TRUE,
),
'links_full' => array(
'description' => 'if displayed in node link on full nodes.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
),
'links_teaser' => array(
'description' => 'if displayed in node links on teasers.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
),
),
'indexes' => array(
'type' => array(
'type',
),
),
);
return $schema;
}