function uc_product_power_tools_update_1 in Ubercart Product Power Tools 6
Same name and namespace in other branches
- 6.2 uc_product_power_tools.install \uc_product_power_tools_update_1()
Adds shipping weight and dimensions.
File
- ./
uc_product_power_tools.install, line 268 - Install, update, and uninstall functions for the uc_product_power_tools module.
Code
function uc_product_power_tools_update_1() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {uc_power_tools} ADD weight float unsigned NOT NULL default 0 AFTER `stock-threshold`");
$ret[] = update_sql("ALTER TABLE {uc_power_tools} ADD weight_units varchar(255) NOT NULL default 'lb'");
$ret[] = update_sql("ALTER TABLE {uc_power_tools} ADD length float unsigned NOT NULL default 0 AFTER weight_units");
$ret[] = update_sql("ALTER TABLE {uc_power_tools} ADD width float unsigned NOT NULL default 0 AFTER length");
$ret[] = update_sql("ALTER TABLE {uc_power_tools} ADD height float unsigned NOT NULL default 0 AFTER width");
$ret[] = update_sql("ALTER TABLE {uc_power_tools} ADD length_units varchar(255) NOT NULL default 'in' AFTER height");
break;
case 'pgsql':
db_add_column($ret, 'uc_power_tools', 'weight', 'float unsigned', array(
'not null' => TRUE,
'default' => 0,
));
db_add_column($ret, 'uc_power_tools', 'weight_units', 'varchar(255)', array(
'not null' => TRUE,
'default' => 'lb',
));
db_add_column($ret, 'uc_power_tools', 'length', 'float unsigned', array(
'not null' => TRUE,
'default' => 0,
));
db_add_column($ret, 'uc_power_tools', 'width', 'float unsigned', array(
'not null' => TRUE,
'default' => 0,
));
db_add_column($ret, 'uc_power_tools', 'height', 'float unsigned', array(
'not null' => TRUE,
'default' => 0,
));
db_add_column($ret, 'uc_power_tools', 'length_units', 'varchar(255)', array(
'not null' => TRUE,
'default' => 'in',
));
break;
}
return $ret;
}