You are here

function ad_channel_update_6004 in Advertisement 6.2

Same name and namespace in other branches
  1. 6.3 channel/ad_channel.install \ad_channel_update_6004()
  2. 7 channel/ad_channel.install \ad_channel_update_6004()

Introduce no_channel_percent.

File

channel/ad_channel.install, line 225

Code

function ad_channel_update_6004() {
  $ret = array();
  $ret[] = update_sql("ALTER TABLE {ad_channel} CHANGE COLUMN no_channel_weight no_channel_percent INT(3) NOT NULL DEFAULT '0'");

  // migration of no_channel_weights to no_channel_percent is an approximation
  // to evenly distribute legacy values to new inorder to maintain weighting
  $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=20 WHERE no_channel_percent=25");
  $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=25 WHERE no_channel_percent=33");
  $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=35 WHERE no_channel_percent=50");
  $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=50 WHERE no_channel_percent=100");
  $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=65 WHERE no_channel_percent=200");
  $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=75 WHERE no_channel_percent=300");
  $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=80 WHERE no_channel_percent=400");
  return $ret;
}