function uc_attribute_schema in Ubercart 6.2
Same name and namespace in other branches
- 8.4 uc_attribute/uc_attribute.install \uc_attribute_schema()
- 7.3 uc_attribute/uc_attribute.install \uc_attribute_schema()
Implements hook_schema().
File
- uc_attribute/
uc_attribute.install, line 11 - Install hooks for uc_attribute.module.
Code
function uc_attribute_schema() {
$schema = array();
$schema['uc_attributes'] = array(
'description' => 'Attributes: the decisions that need to be made about products.',
'fields' => array(
'aid' => array(
'description' => 'Primary key: attribute ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'Name of the attribute.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'label' => array(
'description' => 'Label to use when attribute is displayed.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'ordering' => array(
'description' => 'Determines the list position of attributes.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'required' => array(
'description' => 'Flag that, if set, requires a user response for attributes (disables default options).',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'display' => array(
'description' => 'Display type of the attribute options: 0 => text fields, 1 => select box (default), 2 => radio buttons.',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
),
'description' => array(
'description' => 'Description of the attribute.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'aid',
),
);
$schema['uc_attribute_options'] = array(
'description' => 'The available choices for each attribute.',
'fields' => array(
'aid' => array(
'description' => 'The {uc_attributes}.aid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'oid' => array(
'description' => 'Primary key: the option ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'The name of the option.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'cost' => array(
'description' => "The adjustment to a product's cost with the chosen option.",
'type' => 'numeric',
'precision' => 16,
'scale' => 5,
'not null' => TRUE,
'default' => 0,
),
'price' => array(
'description' => "The adjustment to a product's price with the chosen option.",
'type' => 'numeric',
'precision' => 16,
'scale' => 5,
'not null' => TRUE,
'default' => 0,
),
'weight' => array(
'description' => "The adjustment to a product's physical weight with the chosen option.",
'type' => 'float',
'not null' => TRUE,
'default' => 0,
),
'ordering' => array(
'description' => 'Affects the list position of the options.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'oid',
),
'indexes' => array(
'aid' => array(
'aid',
),
),
);
$schema['uc_class_attributes'] = array(
'description' => 'Attributes copied to a product of a certain class when it is created.',
'fields' => array(
'pcid' => array(
'description' => 'Primary key: the product {node}.type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'aid' => array(
'description' => 'The {uc_attributes}.aid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'label' => array(
'description' => 'Label to use when attribute is displayed.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'ordering' => array(
'description' => 'Determines the list position of attributes.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'default_option' => array(
'description' => 'The default value of the attribute field on the add to cart form.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'required' => array(
'description' => "A flag indicating that, if set, requires a user response for attributes (disables default options).",
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'display' => array(
'description' => 'Display type of the attribute options: 0 => text fields, 1 => select box (default), 2 => radio buttons',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array(
'pcid',
'aid',
),
);
$schema['uc_class_attribute_options'] = array(
'description' => 'The available choices for each attribute.',
'fields' => array(
'pcid' => array(
'description' => 'Primary key: the product {node}.type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'oid' => array(
'description' => 'The {uc_attribute_options}.oid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'cost' => array(
'description' => "The adjustment to a product's cost with the chosen option.",
'type' => 'numeric',
'precision' => 16,
'scale' => 5,
'not null' => TRUE,
'default' => 0,
),
'price' => array(
'description' => "The adjustment to a product's price with the chosen option.",
'type' => 'numeric',
'precision' => 16,
'scale' => 5,
'not null' => TRUE,
'default' => 0,
),
'weight' => array(
'description' => "The adjustment to a product's physical weight with the chosen option.",
'type' => 'float',
'not null' => TRUE,
'default' => 0,
),
'ordering' => array(
'description' => 'Affects the list position of the options.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'pcid',
'oid',
),
);
$schema['uc_product_attributes'] = array(
'description' => 'Attributes copied to a product.',
'fields' => array(
'nid' => array(
'description' => 'The product {node}.nid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'aid' => array(
'description' => 'The {uc_attributes}.aid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'label' => array(
'description' => 'Label to use when attribute is displayed',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'ordering' => array(
'description' => 'Determines the list position of attributes.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'default_option' => array(
'description' => 'The default value of the attribute field on the add to cart form.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'required' => array(
'description' => "Flag that, if set, requires a user response for attributes (disables default options).",
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'display' => array(
'description' => 'Display type of the attribute options: 0 -- text fields, 1 -- select box (default), 2 -- radio buttons',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array(
'nid',
'aid',
),
);
$schema['uc_product_options'] = array(
'description' => 'The available choices for each attribute.',
'fields' => array(
'nid' => array(
'description' => 'The product {node}.nid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'oid' => array(
'description' => 'The {uc_attribute_options}.oid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'cost' => array(
'description' => "The adjustment to a product's cost with the chosen option.",
'type' => 'numeric',
'precision' => 16,
'scale' => 5,
'not null' => TRUE,
'default' => 0,
),
'price' => array(
'description' => "The adjustment to a product's price with the chosen option.",
'type' => 'numeric',
'precision' => 16,
'scale' => 5,
'not null' => TRUE,
'default' => 0,
),
'weight' => array(
'description' => "The adjustment to a product's physical weight with the chosen option.",
'type' => 'float',
'not null' => TRUE,
'default' => 0,
),
'ordering' => array(
'description' => 'Affects the list position of the options.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
'oid',
),
);
$schema['uc_product_adjustments'] = array(
'description' => "Changes to a product's SKU based on the possible combination of chosen options.",
'fields' => array(
'nid' => array(
'description' => 'The product {node}.nid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'combination' => array(
'description' => 'A serialized array whose keys are attribute IDs and values are option IDs.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'model' => array(
'description' => 'The SKU representing the product with the combination of options.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'indexes' => array(
'nid' => array(
'nid',
),
),
);
return $schema;
}