Mercurial > defr > drupal > ad
diff channel/ad_channel.install @ 7:6aeff3329e01 ad
maj module ad 2.1rc1
author | piotre |
---|---|
date | Mon, 20 Jul 2009 13:54:40 +0000 |
parents | 416ea999ed76 |
children | 32c1a7d9e1fa |
line wrap: on
line diff
--- a/channel/ad_channel.install Thu May 28 14:53:07 2009 +0000 +++ b/channel/ad_channel.install Mon Jul 20 13:54:40 2009 +0000 @@ -1,5 +1,5 @@ <?php -// $Id: ad_channel.install,v 1.1.4.6 2009/04/15 17:19:51 jeremy Exp $ +// $Id: ad_channel.install,v 1.1.4.8 2009/07/11 16:39:21 jeremy Exp $ /** * @@ -25,7 +25,7 @@ conid INT(11) UNSIGNED NOT NULL DEFAULT '0', weight TINYINT(4) SIGNED NOT NULL DEFAULT '0', display TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', - no_channel_weight INT(3) NOT NULL DEFAULT '0', + no_channel_percent INT(3) NOT NULL DEFAULT '0', urls TEXT NULL, groups TEXT NULL, PRIMARY KEY (chid), @@ -107,3 +107,30 @@ return $ret; } +/** + * Introduce no_channel_percent. + */ +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; +} + +/* + * Introduce channel inventory and remnant ads + */ +function ad_channel_update_6005() { + $ret = array(); + $ret[] = update_sql("ALTER TABLE {ad_channel} ADD inventory INT(11)"); + $ret[] = update_sql("CREATE TABLE {ad_channel_remnant} (aid INT(11) UNSIGNED NOT NULL DEFAULT '0', remnant TINYINT UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (aid, remnant))"); + return $ret; +}