Mercurial > defr > drupal > ad
comparison 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 |
comparison
equal
deleted
inserted
replaced
6:b7653861e0b4 | 7:6aeff3329e01 |
---|---|
1 <?php | 1 <?php |
2 // $Id: ad_channel.install,v 1.1.4.6 2009/04/15 17:19:51 jeremy Exp $ | 2 // $Id: ad_channel.install,v 1.1.4.8 2009/07/11 16:39:21 jeremy Exp $ |
3 | 3 |
4 /** | 4 /** |
5 * | 5 * |
6 * Ad channel database schema. | 6 * Ad channel database schema. |
7 * Copyright (c) 2008-2009 Jeremy Andrews <jeremy@tag1consulting.com>. | 7 * Copyright (c) 2008-2009 Jeremy Andrews <jeremy@tag1consulting.com>. |
23 name VARCHAR(64) NOT NULL DEFAULT '', | 23 name VARCHAR(64) NOT NULL DEFAULT '', |
24 description LONGTEXT NULL, | 24 description LONGTEXT NULL, |
25 conid INT(11) UNSIGNED NOT NULL DEFAULT '0', | 25 conid INT(11) UNSIGNED NOT NULL DEFAULT '0', |
26 weight TINYINT(4) SIGNED NOT NULL DEFAULT '0', | 26 weight TINYINT(4) SIGNED NOT NULL DEFAULT '0', |
27 display TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', | 27 display TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', |
28 no_channel_weight INT(3) NOT NULL DEFAULT '0', | 28 no_channel_percent INT(3) NOT NULL DEFAULT '0', |
29 urls TEXT NULL, | 29 urls TEXT NULL, |
30 groups TEXT NULL, | 30 groups TEXT NULL, |
31 PRIMARY KEY (chid), | 31 PRIMARY KEY (chid), |
32 KEY (name) | 32 KEY (name) |
33 );"); | 33 );"); |
105 $ret = array(); | 105 $ret = array(); |
106 $ret[] = update_sql("ALTER TABLE {ad_channel} ADD no_channel_weight INT(3) NOT NULL DEFAULT '0'"); | 106 $ret[] = update_sql("ALTER TABLE {ad_channel} ADD no_channel_weight INT(3) NOT NULL DEFAULT '0'"); |
107 return $ret; | 107 return $ret; |
108 } | 108 } |
109 | 109 |
110 /** | |
111 * Introduce no_channel_percent. | |
112 */ | |
113 function ad_channel_update_6004() { | |
114 $ret = array(); | |
115 $ret[] = update_sql("ALTER TABLE {ad_channel} CHANGE COLUMN no_channel_weight no_channel_percent INT(3) NOT NULL DEFAULT '0'"); | |
116 // migration of no_channel_weights to no_channel_percent is an approximation | |
117 // to evenly distribute legacy values to new inorder to maintain weighting | |
118 $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=20 WHERE no_channel_percent=25"); | |
119 $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=25 WHERE no_channel_percent=33"); | |
120 $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=35 WHERE no_channel_percent=50"); | |
121 $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=50 WHERE no_channel_percent=100"); | |
122 $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=65 WHERE no_channel_percent=200"); | |
123 $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=75 WHERE no_channel_percent=300"); | |
124 $ret[] = update_sql("UPDATE {ad_channel} SET no_channel_percent=80 WHERE no_channel_percent=400"); | |
125 return $ret; | |
126 } | |
127 | |
128 /* | |
129 * Introduce channel inventory and remnant ads | |
130 */ | |
131 function ad_channel_update_6005() { | |
132 $ret = array(); | |
133 $ret[] = update_sql("ALTER TABLE {ad_channel} ADD inventory INT(11)"); | |
134 $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))"); | |
135 return $ret; | |
136 } |