function uc_attribute_update_6000 in Ubercart 6.2
File
- uc_attribute/
uc_attribute.install, line 402 - Install hooks for uc_attribute.module.
Code
function uc_attribute_update_6000() {
$ret = array();
// Standardize database definitions during upgrade to Drupal 6.
// ID fields are unsigned, regular-sized ints.
// "Boolean" flags are unsigned tiny ints.
// Postgres tables will have the necessary default values, and MySQL
// doesn't need them, so the schema can just be mismatched for that.
// Some id columns are already auto-incremented, so we can't remove the
// primary key beforehand in MySQL. So we add it later for Postgres.
db_change_field($ret, 'uc_attributes', 'aid', 'aid', array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
));
db_change_field($ret, 'uc_attributes', 'required', 'required', array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_attributes', 'display', 'display', array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
));
if ($GLOBALS['db_type'] == 'pgsql') {
db_add_primary_key($ret, 'uc_attributes', array(
'aid',
));
}
db_change_field($ret, 'uc_attribute_options', 'aid', 'aid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_attribute_options', 'oid', 'oid', array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
));
if ($GLOBALS['db_type'] == 'pgsql') {
db_add_primary_key($ret, 'uc_attribute_options', array(
'oid',
));
}
db_drop_primary_key($ret, 'uc_class_attributes');
db_change_field($ret, 'uc_class_attributes', 'aid', 'aid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
), array(
'primary key' => array(
'pcid',
'aid',
),
));
db_change_field($ret, 'uc_class_attributes', 'default_option', 'default_option', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_class_attributes', 'required', 'required', array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_class_attributes', 'display', 'display', array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
));
db_drop_primary_key($ret, 'uc_class_attribute_options');
db_change_field($ret, 'uc_class_attribute_options', 'oid', 'oid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
), array(
'primary key' => array(
'pcid',
'oid',
),
));
db_drop_primary_key($ret, 'uc_product_attributes');
db_change_field($ret, 'uc_product_attributes', 'nid', 'nid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_product_attributes', 'aid', 'aid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_product_attributes', 'default_option', 'default_option', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_product_attributes', 'required', 'required', array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_product_attributes', 'display', 'display', array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
));
db_add_primary_key($ret, 'uc_product_attributes', array(
'nid',
'aid',
));
db_drop_primary_key($ret, 'uc_product_options');
db_change_field($ret, 'uc_product_options', 'nid', 'nid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_change_field($ret, 'uc_product_options', 'oid', 'oid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_add_primary_key($ret, 'uc_product_options', array(
'nid',
'oid',
));
db_drop_primary_key($ret, 'uc_product_adjustments');
db_change_field($ret, 'uc_product_adjustments', 'nid', 'nid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
), array(
'indexes' => array(
'nid' => array(
'nid',
),
),
));
return $ret;
}