You are here

function uc_coupon_update_6001 in Ubercart Discount Coupons 6

File

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

Code

function uc_coupon_update_6001() {
  $ret = array();
  if (!db_column_exists('uc_coupons', 'bulk')) {
    $field = array(
      'type' => 'int',
      'size' => 'tiny',
      'not null' => TRUE,
      'default' => 0,
    );
    db_add_field($ret, 'uc_coupons', 'bulk', $field);
    $field = array(
      'type' => 'char',
      'length' => 32,
      'not null' => TRUE,
      'default' => '',
    );
    db_add_field($ret, 'uc_coupons', 'bulk_seed', $field);
    $ret[] = update_sql("UPDATE {uc_coupons} SET bulk_seed = MD5(CAST(RAND() AS CHAR(32))) WHERE bulk_seed = ''");
  }
  return $ret;
}