You are here

function uc_taxes_update_5 in Ubercart 5

File

uc_taxes/uc_taxes.install, line 113

Code

function uc_taxes_update_5() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {uc_taxes} ADD COLUMN taxed_product_types text NOT NULL AFTER rate");
      break;
    case 'pgsql':
      db_add_column($ret, 'uc_taxes', 'taxed_product_types', 'text', array(
        'not null' => true,
        'default' => "''",
      ));
      break;
  }
  $types = array();
  foreach (module_invoke_all('product_types') as $type) {
    $types[$type] = $type;
  }
  db_query("UPDATE {uc_taxes} SET taxed_product_types = '%s'", serialize($types));
  return $ret;
}