You are here

function uc_coupon_update_3 in Ubercart Discount Coupons 5

File

./uc_coupon.install, line 75
Ubercart uc_coupon.module schema

Code

function uc_coupon_update_3() {
  $result = db_query('SELECT cid, data, roles FROM {uc_coupons}');
  while ($row = db_fetch_object($result)) {
    $data = $row->data ? unserialize($row->data) : array();
    $data['wholesale'] = $row->roles;
    db_query("UPDATE {uc_coupons} SET data = '%s' WHERE cid = %d", serialize($data), $row->cid);
  }
  $ret[] = update_sql("ALTER TABLE {uc_coupons} DROP COLUMN roles");
  return $ret;
}