You are here

function uc_product_update_2 in Ubercart 5

File

uc_product/uc_product.install, line 131
Database installation, uninstallation, and updates for the product module.

Code

function uc_product_update_2() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {uc_product_class_choices} DROP PRIMARY KEY");
      $ret[] = update_sql("ALTER TABLE {uc_product_class_choices} CHANGE value value text NOT NULL");
      $ret[] = update_sql("ALTER TABLE {uc_product_class_choices} ADD PRIMARY KEY (nid, cfid, value (3))");
      break;
    case 'pgsql':
      $ret[] = update_sql("ALTER TABLE {uc_product_class_choices} DROP CONSTRAINT {uc_product_class_choices}_pkey");
      db_change_column($ret, 'uc_product_class_choices', 'value', 'value', 'text', array(
        'not null' => true,
        'default' => "''",
      ));
      $ret[] = update_sql("ALTER TABLE {uc_product_class_choices} ADD PRIMARY KEY (nid, cfid, value (3))");
      break;
  }
  return $ret;
}