You are here

function uc_attribute_update_5 in Ubercart 5

File

uc_attribute/uc_attribute.install, line 247

Code

function uc_attribute_update_5() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {uc_attribute_options} ADD COLUMN cost decimal(10,2) NOT NULL AFTER name");
      $ret[] = update_sql("ALTER TABLE {uc_class_attribute_options} ADD COLUMN cost decimal(10,2) NOT NULL AFTER oid");
      $ret[] = update_sql("ALTER TABLE {uc_product_options} ADD COLUMN cost decimal(10,2) NOT NULL AFTER oid");
      break;
    case 'pgsql':
      db_add_column($ret, 'uc_attribute_options', 'cost', 'decimal(10,2)', array(
        'not null' => true,
        'default' => 0.0,
      ));
      db_add_column($ret, 'uc_class_attribute_options', 'cost', 'decimal(10,2)', array(
        'not null' => true,
        'default' => 0.0,
      ));
      db_add_column($ret, 'uc_product_options', 'cost', 'decimal(10,2)', array(
        'not null' => true,
        'default' => 0.0,
      ));
      break;
  }
  return $ret;
}