You are here

function uc_dropdown_attributes_schema in Dropdown Attributes 8

Same name and namespace in other branches
  1. 6 uc_dropdown_attributes.install \uc_dropdown_attributes_schema()
  2. 7 uc_dropdown_attributes.install \uc_dropdown_attributes_schema()

Implements hook_schema().

File

./uc_dropdown_attributes.install, line 11
Install, update, and uninstall functions for uc_dropdown_attributes.

Code

function uc_dropdown_attributes_schema() {
  $schema['uc_dropdown_products'] = array(
    'description' => 'Stores attributes that are displayed depending on the value of another attribute.',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Node id of product',
      ),
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Attribute id of child',
      ),
      'parent_aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Attribute id of parent',
      ),
      'parent_values' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'normal',
        'description' => 'Values of the parent attribute that trigger the dependent attribute',
      ),
      'required' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'Whether the dependent attribute is optional (0) or required (1)',
      ),
    ),
    'primary key' => array(
      'nid',
      'aid',
    ),
  );
  $schema['uc_dropdown_classes'] = array(
    'description' => 'Stores attributes that are displayed depending on the value of another attribute.',
    'fields' => array(
      'pcid' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'description' => 'Product class id',
      ),
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Attribute id of child',
      ),
      'parent_aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Attribute id of parent',
      ),
      'parent_values' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'normal',
        'description' => 'Values of the parent attribute that trigger the dependent attribute',
      ),
      'required' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'Whether the dependent attribute is optional (0) or required (1)',
      ),
    ),
    'primary key' => array(
      'pcid',
      'aid',
    ),
  );
  return $schema;
}