1
|
|
|
<?php |
2
|
|
|
// This file is part of BOINC. |
3
|
|
|
// http://boinc.berkeley.edu |
4
|
|
|
// Copyright (C) 2008 University of California |
5
|
|
|
// |
6
|
|
|
// BOINC is free software; you can redistribute it and/or modify it |
7
|
|
|
// under the terms of the GNU Lesser General Public License |
8
|
|
|
// as published by the Free Software Foundation, |
9
|
|
|
// either version 3 of the License, or (at your option) any later version. |
10
|
|
|
// |
11
|
|
|
// BOINC is distributed in the hope that it will be useful, |
12
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14
|
|
|
// See the GNU Lesser General Public License for more details. |
15
|
|
|
// |
16
|
|
|
// You should have received a copy of the GNU Lesser General Public License |
17
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
18
|
|
|
|
19
|
|
|
// code for one-time database updates goes here. |
20
|
|
|
// Don't run this unless you know what you're doing! |
21
|
|
|
|
22
|
|
|
$cli_only = true; |
23
|
|
|
require_once("../inc/util_ops.inc"); |
24
|
|
|
|
25
|
|
|
$db = BoincDb::get(0); |
26
|
|
|
if (!$db) { |
27
|
|
|
echo "db_update.php: Can't open database\n"; |
28
|
|
|
exit; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
set_time_limit(0); |
32
|
|
|
|
33
|
|
|
function do_query($query) { |
34
|
|
|
echo "Doing query:\n$query\n"; |
35
|
|
|
$result = _mysql_query($query); |
36
|
|
|
if (!$result) { |
37
|
|
|
echo "Failed:\n"._mysql_error()."\n"; |
38
|
|
|
return false; |
39
|
|
|
} else { |
40
|
|
|
echo "Success.\n"; |
41
|
|
|
return true; |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
function update_4_18_2004() { |
46
|
|
|
do_query("alter table user add cross_project_id varchar(254) not null"); |
47
|
|
|
$result = do_query("select * from user"); |
48
|
|
|
while ($user = _mysql_fetch_object($result)) { |
49
|
|
|
$x = random_string(); |
50
|
|
|
do_query("update user set cross_project_id='$x' where id=$user->id"); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
function update_5_12_2004() { |
55
|
|
|
do_query( |
56
|
|
|
"create table trickle_up ( |
57
|
|
|
id integer not null auto_increment, |
58
|
|
|
create_time integer not null, |
59
|
|
|
send_time integer not null, |
60
|
|
|
resultid integer not null, |
61
|
|
|
appid integer not null, |
62
|
|
|
hostid integer not null, |
63
|
|
|
handled smallint not null, |
64
|
|
|
xml text, |
65
|
|
|
primary key (id) |
66
|
|
|
)" |
67
|
|
|
); |
68
|
|
|
do_query( |
69
|
|
|
"create table trickle_down ( |
70
|
|
|
id integer not null auto_increment, |
71
|
|
|
create_time integer not null, |
72
|
|
|
resultid integer not null, |
73
|
|
|
hostid integer not null, |
74
|
|
|
handled smallint not null, |
75
|
|
|
xml text, |
76
|
|
|
primary key (id) |
77
|
|
|
)" |
78
|
|
|
); |
79
|
|
|
do_query( |
80
|
|
|
"alter table trickle_up add index trickle_handled (appid, handled)" |
81
|
|
|
); |
82
|
|
|
do_query( |
83
|
|
|
"alter table trickle_down add index trickle_host(hostid, handled)" |
84
|
|
|
); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
function update_5_27_2004() { |
88
|
|
|
do_query( |
89
|
|
|
"alter table host add nresults_today integer not null" |
90
|
|
|
); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
function update_6_9_2004() { |
94
|
|
|
do_query( |
95
|
|
|
"alter table profile change verification verification integer not null" |
96
|
|
|
); |
97
|
|
|
} |
98
|
|
|
function update_6_15_2004() { |
99
|
|
|
do_query( |
100
|
|
|
"alter table user add index user_name(name)" |
101
|
|
|
); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
function update_7_02_2004() { |
105
|
|
|
do_query( |
106
|
|
|
"alter table workunit drop column result_template" |
107
|
|
|
); |
108
|
|
|
do_query( |
109
|
|
|
"alter table workunit add column result_template_file varchar(63) not null" |
110
|
|
|
); |
111
|
|
|
do_query( |
112
|
|
|
"update workunit set result_template_file='templates/foo.xml'" |
113
|
|
|
); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
function update_7_08_2004() { |
117
|
|
|
do_query( |
118
|
|
|
"alter table result drop index ind_res_st" |
119
|
|
|
); |
120
|
|
|
do_query( |
121
|
|
|
"alter table add index ind_res_st(server_state)" |
122
|
|
|
); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
function update_9_04_2004() { |
126
|
|
|
do_query( |
127
|
|
|
"insert into forum_preferences (userid, signature, posts) select user.id, user.signature, user.posts from user where user.posts > 0 or user.signature<>''"); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
function update_9_05_2004() { |
131
|
|
|
do_query( |
132
|
|
|
"ALTER TABLE forum_preferences ADD special_user INT NOT NULL" |
133
|
|
|
); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
function update_9_26_2004() { |
137
|
|
|
do_query( |
138
|
|
|
"alter table app add homogeneous_redundancy smallint not null" |
139
|
|
|
); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
function update_10_09_2004() { |
143
|
|
|
do_query( |
144
|
|
|
"alter table forum_preferences add jump_to_unread tinyint(1) unsigned not null default 1" |
145
|
|
|
); |
146
|
|
|
do_query( |
147
|
|
|
"alter table forum_preferences add hide_signatures tinyint(1) unsigned not null default 0" |
148
|
|
|
); |
149
|
|
|
do_query( |
150
|
|
|
"alter table post add signature tinyint(1) unsigned not null default 0" |
151
|
|
|
); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
function update_10_25_2004() { |
155
|
|
|
do_query( |
156
|
|
|
"alter table forum_preferences add rated_posts varchar(254) not null" |
157
|
|
|
); |
158
|
|
|
do_query( |
159
|
|
|
"alter table forum_preferences add low_rating_threshold integer not null" |
160
|
|
|
); |
161
|
|
|
do_query( |
162
|
|
|
"alter table forum_preferences add high_rating_threshold integer not null" |
163
|
|
|
); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
function update_10_26_2004() { |
167
|
|
|
do_query("alter table forum_preferences modify jump_to_unread tinyint(1) unsigned not null default 0"); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
function update_11_24_2004() { |
171
|
|
|
do_query( |
172
|
|
|
"alter table workunit change workseq_next hr_class integer not null" |
173
|
|
|
); |
174
|
|
|
do_query( |
175
|
|
|
"alter table workunit add priority integer not null" |
176
|
|
|
); |
177
|
|
|
do_query( |
178
|
|
|
"alter table workunit add mod_time timestamp" |
179
|
|
|
); |
180
|
|
|
do_query( |
181
|
|
|
"alter table result add priority integer not null" |
182
|
|
|
); |
183
|
|
|
do_query( |
184
|
|
|
"alter table result add mod_time timestamp" |
185
|
|
|
); |
186
|
|
|
do_query( |
187
|
|
|
"alter table host drop column projects" |
188
|
|
|
); |
189
|
|
|
do_query( |
190
|
|
|
"alter table host add avg_turnaround double not null" |
191
|
|
|
); |
192
|
|
|
do_query( |
193
|
|
|
"alter table result drop index ind_res_st" |
194
|
|
|
); |
195
|
|
|
do_query( |
196
|
|
|
"alter table result add index ind_res_st(server_state, priority)" |
197
|
|
|
); |
198
|
|
|
do_query( |
199
|
|
|
"alter table result drop index app_received_time" |
200
|
|
|
); |
201
|
|
|
do_query( |
202
|
|
|
"alter table result add index app_mod_time(appid, mod_time desc)" |
203
|
|
|
); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
// or alternatively: (can run in parallel) |
207
|
|
|
|
208
|
|
|
function update_11_24_2004_result() { |
209
|
|
|
do_query( |
210
|
|
|
"alter table result add priority integer not null, " |
211
|
|
|
."add mod_time timestamp, " |
212
|
|
|
."drop index ind_res_st, " |
213
|
|
|
."add index ind_res_st(server_state, priority), " |
214
|
|
|
."drop index app_received_time, " |
215
|
|
|
."add index app_mod_time(appid, mod_time desc)" |
216
|
|
|
); |
217
|
|
|
} |
218
|
|
|
function update_11_24_2004_workunit() { |
219
|
|
|
do_query( |
220
|
|
|
"alter table workunit " |
221
|
|
|
." change workseq_next hr_class integer not null, " |
222
|
|
|
." add priority integer not null, " |
223
|
|
|
." add mod_time timestamp" |
224
|
|
|
); |
225
|
|
|
} |
226
|
|
|
function update_11_24_2004_host() { |
227
|
|
|
do_query( |
228
|
|
|
"alter table host drop column projects, " |
229
|
|
|
." add avg_turnaround double not null" |
230
|
|
|
); |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
function update_12_27_2004() { |
234
|
|
|
do_query("alter table workunit drop index wu_filedel"); |
235
|
|
|
do_query("alter table workunit add index wu_filedel (file_delete_state, mod_time)"); |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
function update_1_3_2005() { |
239
|
|
|
do_query("alter table workunit drop index wu_filedel"); |
240
|
|
|
do_query("alter table workunit add index wu_filedel (file_delete_state)"); |
241
|
|
|
do_query("alter table result drop index app_mod_time"); |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
function update_1_7_2005() { |
245
|
|
|
do_query("alter table forum_preferences add ignorelist varchar(254) not null"); |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
function update_1_13_2005() { |
249
|
|
|
do_query("alter table thread add hidden integer not null"); |
250
|
|
|
do_query("alter table post add hidden integer not null"); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
function update_1_18_2005() { |
254
|
|
|
do_query("ALTER TABLE forum_preferences CHANGE special_user special_user CHAR(12) DEFAULT '0' NOT NULL"); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
function update_1_19_2005() { |
258
|
|
|
do_query("create table tentative_user ( |
259
|
|
|
nonce varchar(254) not null, |
260
|
|
|
email_addr varchar(254) not null, |
261
|
|
|
confirmed integer not null, |
262
|
|
|
primary key(nonce) |
263
|
|
|
);" |
264
|
|
|
); |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
function update_1_20_2005() { |
268
|
|
|
do_query("alter table host add host_cpid varchar(254)"); |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
function update_1_20a_2005() { |
272
|
|
|
do_query("alter table host add external_ip_addr varchar(254)"); |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
function update_2_25_2005() { |
276
|
|
|
do_query("alter table host add max_results_day integer not null"); |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
function update_4_20_2005(){ |
280
|
|
|
do_query("ALTER TABLE `thread` ADD `sticky` TINYINT UNSIGNED DEFAULT '0' NOT NULL"); |
281
|
|
|
do_query("ALTER TABLE `forum` ADD `post_min_total_credit` INT NOT NULL AFTER `posts`"); |
282
|
|
|
do_query("ALTER TABLE `forum` ADD `post_min_expavg_credit` INT NOT NULL AFTER `posts`"); |
283
|
|
|
do_query("ALTER TABLE `forum` ADD `post_min_interval` INT NOT NULL AFTER `posts`"); |
284
|
|
|
do_query("ALTER TABLE `forum` ADD `rate_min_total_credit` INT NOT NULL AFTER `posts`"); |
285
|
|
|
do_query("ALTER TABLE `forum` ADD `rate_min_expavg_credit` INT NOT NULL AFTER `posts`"); |
286
|
|
|
do_query("ALTER TABLE `forum_preferences` ADD `last_post` INT( 14 ) UNSIGNED NOT NULL AFTER `posts`"); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
function update_4_30_2005(){ |
290
|
|
|
do_query("ALTER TABLE `forum_preferences` ADD `ignore_sticky_posts` TINYINT( 1 ) UNSIGNED NOT NULL"); |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
function update_6_22_2005() { |
294
|
|
|
do_query("alter table host add cpu_efficiency double not null after active_frac, add duration_correction_factor double not null after cpu_efficiency"); |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
function update_8_05_2005() { |
298
|
|
|
do_query("alter table user add passwd_hash varchar(254) not null"); |
299
|
|
|
do_query("alter table user add email_validated smallint not null"); |
300
|
|
|
do_query("update user set passwd_hash=MD5(concat(authenticator, email_addr))"); |
301
|
|
|
do_query("update user set email_validated=1"); |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
function update_8_25_2005() { |
305
|
|
|
do_query("alter table user add donated smallint not null"); |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
function update_8_26_2005() { |
309
|
|
|
do_query("drop table tentative_user"); |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
function update_9_22_2005() { |
313
|
|
|
do_query("update user set country='Macedonia' where country='Macedonia, The Former Yugoslav Republic of'"); |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
function update_11_24_2005(){ |
317
|
|
|
do_query("ALTER TABLE `forum_preferences` ADD `minimum_wrap_postcount` INT DEFAULT '100' NOT NULL AFTER `high_rating_threshold` , |
318
|
|
|
ADD `display_wrap_postcount` INT DEFAULT '75' NOT NULL AFTER `minimum_wrap_postcount`"); |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
function update_6_16_2006() { |
322
|
|
|
do_query("ALTER TABLE `thread` ADD `score` DOUBLE NOT NULL AFTER `sufferers` , ADD `votes` INT NOT NULL AFTER `score`"); |
323
|
|
|
do_query("ALTER TABLE `forum_preferences` ADD `forum_sorting` INT NOT NULL AFTER `sorting`"); |
324
|
|
|
do_query("ALTER TABLE `forum_preferences` ADD `thread_sorting` INT NOT NULL AFTER `forum_sorting`"); |
325
|
|
|
|
326
|
|
|
do_query("CREATE TABLE `post_ratings` ( |
327
|
|
|
`post` INT UNSIGNED NOT NULL , |
328
|
|
|
`user` INT UNSIGNED NOT NULL , |
329
|
|
|
`rating` TINYINT NOT NULL , |
330
|
|
|
PRIMARY KEY ( `post` , `user`))"); |
331
|
|
|
|
332
|
|
|
do_query("ALTER TABLE `forum_preferences` DROP `avatar_type`"); |
333
|
|
|
do_query("ALTER TABLE `forum_preferences` CHANGE `low_rating_threshold` `low_rating_threshold` INT( 11 ) DEFAULT '-25' NOT NULL"); |
334
|
|
|
do_query("ALTER TABLE `forum_preferences` CHANGE `high_rating_threshold` `high_rating_threshold` INT( 11 ) DEFAULT '5' NOT NULL"); |
335
|
|
|
do_query("ALTER TABLE `forum_preferences` CHANGE `jump_to_unread` `jump_to_unread` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL"); |
336
|
|
|
|
337
|
|
|
do_query("ALTER TABLE `forum_preferences` DROP `sorting`"); |
338
|
|
|
|
339
|
|
|
do_query("ALTER TABLE `forum_preferences` CHANGE `no_signature_by_default` `no_signature_by_default` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL "); |
340
|
|
|
do_query("ALTER TABLE `thread` ADD `status` SMALLINT UNSIGNED NOT NULL AFTER `owner`"); |
341
|
|
|
|
342
|
|
|
do_query("ALTER TABLE `subscriptions` ADD `notified` TINYINT( 1 ) UNSIGNED DEFAULT '0' NOT NULL"); |
343
|
|
|
do_query("ALTER TABLE `subscriptions` CHANGE `notified` `notified_time` INT( 14 ) UNSIGNED DEFAULT '0' NOT NULL"); |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
function update_7_11_2006() { |
347
|
|
|
do_query("alter table app add weight double not null"); |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
function update_8_8_2006() { |
351
|
|
|
do_query("alter table forum_preferences add banished_until integer not null default 0"); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
function update_10_21_2006() { |
355
|
|
|
do_query("alter table app add beta smallint not null default 0"); |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
function update_10_26_2006() { |
359
|
|
|
do_query("ALTER TABLE `team` ADD `ping_user` INT UNSIGNED NOT NULL DEFAULT '0', |
360
|
|
|
ADD `ping_time` INT UNSIGNED NOT NULL DEFAULT '0'"); |
361
|
|
|
do_query("ALTER TABLE team ADD INDEX team_userid (userid)"); |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
function update_11_10_2006() { |
365
|
|
|
do_query("ALTER TABLE thread ADD locked TINYINT NOT NULL DEFAULT 0"); |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
function update_12_22_2006() { |
369
|
|
|
do_query("ALTER TABLE forum ADD is_dev_blog TINYINT NOT NULL DEFAULT 0"); |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
function update_4_07_2007() { |
373
|
|
|
do_query('create table sent_email ( |
374
|
|
|
userid integer not null, |
375
|
|
|
time_sent integer not null, |
376
|
|
|
email_type smallint not null, |
377
|
|
|
primary key(userid) |
378
|
|
|
) TYPE=MyISAM;' |
379
|
|
|
); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
function update_4_24_2007() { |
383
|
|
|
do_query('alter table host add error_rate double not null default 0'); |
384
|
|
|
|
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
function update_4_29_2007() { |
388
|
|
|
do_query("CREATE TABLE `private_messages` ( |
389
|
|
|
`id` int(10) unsigned NOT NULL auto_increment, |
390
|
|
|
`userid` int(10) unsigned NOT NULL, |
391
|
|
|
`senderid` int(10) unsigned NOT NULL, |
392
|
|
|
`date` int(10) unsigned NOT NULL, |
393
|
|
|
`opened` tinyint(1) unsigned NOT NULL default '0', |
394
|
|
|
`subject` varchar(255) NOT NULL, |
395
|
|
|
`content` text NOT NULL, |
396
|
|
|
PRIMARY KEY (`id`), |
397
|
|
|
KEY `userid` (`userid`) |
398
|
|
|
) TYPE=MyISAM;" |
399
|
|
|
); |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
function update_4_30_2007() { |
403
|
|
|
do_query("create table credited_job ( |
404
|
|
|
userid integer not null, |
405
|
|
|
workunitid bigint not null |
406
|
|
|
) TYPE=MyISAM;"); |
407
|
|
|
do_query("alter table credited_job add index credited_job_user (userid), |
408
|
|
|
add index credited_job_wu (workunitid), |
409
|
|
|
add unique credited_job_user_wu (userid, workunitid);" |
410
|
|
|
); |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
function update_5_27_2007() { |
414
|
|
|
do_query("create table donation_items ( |
415
|
|
|
id integer unsigned not null auto_increment, |
416
|
|
|
item_name varchar(32) not null, |
417
|
|
|
title varchar(255) not null, |
418
|
|
|
description varchar(255) not null, |
419
|
|
|
required double unsigned not null default '0', |
420
|
|
|
PRIMARY KEY(id) |
421
|
|
|
) TYPE=MyISAM;"); |
422
|
|
|
do_query("create table donation_paypal ( |
423
|
|
|
id integer not null auto_increment, |
424
|
|
|
order_time integer unsigned not null, |
425
|
|
|
userid integer not null, |
426
|
|
|
email_addr varchar(255) not null, |
427
|
|
|
order_amount double(6,2) not null, |
428
|
|
|
processed tinyint(1) not null default '0', |
429
|
|
|
payment_time integer unsigned not null, |
430
|
|
|
item_name varchar(255) not null, |
431
|
|
|
item_number varchar(255) not null, |
432
|
|
|
payment_status varchar(255) not null, |
433
|
|
|
payment_amount double(6,2) not null, |
434
|
|
|
payment_fee double(5,2) default null, |
435
|
|
|
payment_currency varchar(255) not null, |
436
|
|
|
txn_id varchar(255) not null, |
437
|
|
|
receiver_email varchar(255) not null, |
438
|
|
|
payer_email varchar(255) not null, |
439
|
|
|
payer_name varchar(255) not null, |
440
|
|
|
PRIMARY KEY(id) |
441
|
|
|
) TYPE=MyISAM;"); |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
function update_6_5_2007() { |
445
|
|
|
do_query("ALTER TABLE `forum_preferences` ADD `pm_notification` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1';"); |
446
|
|
|
} |
447
|
|
|
|
448
|
|
|
function update_7_26_2007() { |
449
|
|
|
do_query("create table team_delta ( |
450
|
|
|
userid integer not null, |
451
|
|
|
teamid integer not null, |
452
|
|
|
timestamp integer not null, |
453
|
|
|
joining tinyint(1) not null, |
454
|
|
|
total_credit double not null |
455
|
|
|
) TYPE=MyISAM;" |
456
|
|
|
); |
457
|
|
|
do_query("alter table team_delta |
458
|
|
|
add index team_delta_teamid (teamid, timestamp);" |
459
|
|
|
); |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
function update_9_26_2007() { |
463
|
|
|
// Change field type from unsigned to signed |
464
|
|
|
do_query("ALTER TABLE team CHANGE ping_user ping_user integer NOT NULL DEFAULT 0"); |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
function update_9_28_2007() { |
468
|
|
|
do_query("alter table team engine=myisam"); |
469
|
|
|
do_query("alter table team change description description text"); |
470
|
|
|
do_query("alter table team add fulltext index team_name_desc(name, description)"); |
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
function update_10_25_2007() { |
474
|
|
|
do_query("update user set country='Serbia' where country='Serbia and Montenegro'"); |
475
|
|
|
do_query("update team set country='Serbia' where country='Serbia and Montenegro'"); |
476
|
|
|
} |
477
|
|
|
|
478
|
|
|
function update_10_26_2007() { |
479
|
|
|
do_query("create table banishment_vote ( |
480
|
|
|
id serial primary key, |
481
|
|
|
userid integer not null, |
482
|
|
|
modid integer not null, |
483
|
|
|
start_time integer not null, |
484
|
|
|
end_time integer not null |
485
|
|
|
) TYPE=MyISAM;" |
486
|
|
|
); |
487
|
|
|
do_query("create table banishment_votes ( |
488
|
|
|
id serial primary key, |
489
|
|
|
voteid integer not null, |
490
|
|
|
modid integer not null, |
491
|
|
|
time integer not null, |
492
|
|
|
yes tinyint(1) not null |
493
|
|
|
) TYPE=MyISAM;" |
494
|
|
|
); |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
function update_11_7_2007() { |
498
|
|
|
do_query("create table team_admin ( |
499
|
|
|
teamid integer not null, |
500
|
|
|
userid integer not null, |
501
|
|
|
create_time integer not null, |
502
|
|
|
rights integer not null |
503
|
|
|
) type=MyISAM;" |
504
|
|
|
); |
505
|
|
|
do_query("alter table team_admin add unique (teamid, userid);"); |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
function update_11_8_2007() { |
509
|
|
|
do_query("alter table forum add parent_type integer not null"); |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
function update_11_14_2007() { |
513
|
|
|
do_query("alter table forum drop index category"); |
514
|
|
|
do_query("alter table forum add unique pct (parent_type, category, title)"); |
515
|
|
|
} |
516
|
|
|
|
517
|
|
|
// pm_notification should be 0 by default. |
518
|
|
|
// We don't know who really wants it to be 1, so set everyone to 0; |
519
|
|
|
// projects might want to run a news item notifying user |
520
|
|
|
// that they need to explicitly set this if they want PM notification |
521
|
|
|
// |
522
|
|
|
function update_11_18_2007() { |
523
|
|
|
do_query("update forum_preferences set pm_notification=0"); |
524
|
|
|
do_query("alter table forum_preferences change pm_notification pm_notification tinyint not null default 0"); |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
function update_11_20_2007() { |
528
|
|
|
do_query("alter table team add fulltext index team_name(name)"); |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
function update_12_18_2007() { |
532
|
|
|
do_query("create table friend ( |
533
|
|
|
user_src integer not null, |
534
|
|
|
user_dest integer not null, |
535
|
|
|
message varchar(255) not null, |
536
|
|
|
create_time integer not null, |
537
|
|
|
reciprocated tinyint not null |
538
|
|
|
) |
539
|
|
|
"); |
540
|
|
|
do_query("create table notify ( |
541
|
|
|
id serial primary key, |
542
|
|
|
userid integer not null, |
543
|
|
|
create_time integer not null, |
544
|
|
|
type integer not null, |
545
|
|
|
opaque integer not null |
546
|
|
|
) |
547
|
|
|
"); |
548
|
|
|
do_query("alter table friend |
549
|
|
|
add unique friend_u (user_src, user_dest) |
550
|
|
|
"); |
551
|
|
|
do_query("alter table notify |
552
|
|
|
add index notify_u (userid) |
553
|
|
|
"); |
554
|
|
|
} |
555
|
|
|
|
556
|
|
|
function update_12_28_2007() { |
557
|
|
|
do_query("alter table notify drop index notify_u"); |
558
|
|
|
do_query("alter table notify |
559
|
|
|
add unique notify_un (userid, type, opaque) |
560
|
|
|
"); |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
function update_2_18_2008() { |
564
|
|
|
do_query("create table assignment ( |
565
|
|
|
id integer not null auto_increment, |
566
|
|
|
create_time integer not null, |
567
|
|
|
target_id integer not null, |
568
|
|
|
target_type integer not null, |
569
|
|
|
multi tinyint not null, |
570
|
|
|
workunitid integer not null, |
571
|
|
|
resultid integer not null, |
572
|
|
|
primary key (id) |
573
|
|
|
) engine = InnoDB |
574
|
|
|
"); |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
// If you haven't done 3_7, skip both of the following: |
578
|
|
|
// |
579
|
|
|
function update_3_7_2008() { |
580
|
|
|
do_query("alter table workunit add column rsc_bandwidth_bound double not null after rsc_disk_bound"); |
581
|
|
|
} |
582
|
|
|
function update_3_7_undo_2008() { |
583
|
|
|
do_query("alter table workunit drop column rsc_bandwidth_bound"); |
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
function update_3_10_2008() { |
587
|
|
|
do_query("alter table workunit add column rsc_bandwidth_bound double not null"); |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
function update_3_13_2008() { |
591
|
|
|
do_query("alter table app_version drop index appid"); |
592
|
|
|
do_query("alter table app_version add column plan_class varchar(254) not null default ''"); |
593
|
|
|
do_query("alter table app_version add unique apvp (appid, platformid, version_num, plan_class)"); |
594
|
|
|
} |
595
|
|
|
|
596
|
|
|
// The following cleans up from a bug that causes "team transfer pending" |
597
|
|
|
// to be shown even after transfer is finished |
598
|
|
|
// |
599
|
|
|
function update_3_27_2008() { |
600
|
|
|
do_query("update team set ping_user=0, ping_time=0 where ping_user=userid"); |
601
|
|
|
} |
602
|
|
|
|
603
|
|
|
function update_3_31_2008() { |
604
|
|
|
do_query("alter table app_version change column xml_doc xml_doc mediumblob"); |
605
|
|
|
} |
606
|
|
|
|
607
|
|
|
function update_6_3_2008() { |
608
|
|
|
do_query("alter table app add target_nresults smallint not null default 0"); |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
function update_7_28_2008() { |
612
|
|
|
do_query("create table credit_multiplier ( |
613
|
|
|
id serial primary key, |
614
|
|
|
appid integer not null, |
615
|
|
|
time integer not null, |
616
|
|
|
multiplier double not null default 0 |
617
|
|
|
) engine=MyISAM |
618
|
|
|
"); |
619
|
|
|
} |
620
|
|
|
|
621
|
|
|
function update_10_05_2008(){ |
622
|
|
|
do_query("alter table forum_preferences add highlight_special tinyint default '1' not null"); |
623
|
|
|
} |
624
|
|
|
|
625
|
|
|
function update_10_7_2008() { |
626
|
|
|
do_query("alter table team add joinable tinyint default '1' not null"); |
627
|
|
|
} |
628
|
|
|
|
629
|
|
|
function update_6_16_2009() { |
630
|
|
|
do_query("create table state_counts ( |
631
|
|
|
appid integer not null, |
632
|
|
|
last_update_time integer not null, |
633
|
|
|
result_server_state_2 integer not null, |
634
|
|
|
result_server_state_4 integer not null, |
635
|
|
|
result_file_delete_state_1 integer not null, |
636
|
|
|
result_file_delete_state_2 integer not null, |
637
|
|
|
result_server_state_5_and_file_delete_state_0 integer not null, |
638
|
|
|
workunit_need_validate_1 integer not null, |
639
|
|
|
workunit_assimilate_state_1 integer not null, |
640
|
|
|
workunit_file_delete_state_1 integer not null, |
641
|
|
|
workunit_file_delete_state_2 integer not null, |
642
|
|
|
primary key (appid) |
643
|
|
|
) engine=MyISAM |
644
|
|
|
"); |
645
|
|
|
} |
646
|
|
|
|
647
|
|
|
function update_9_3_2009() { |
648
|
|
|
do_query("alter table result add ( |
649
|
|
|
elapsed_time double not null, |
650
|
|
|
flops_estimate double not null, |
651
|
|
|
app_version_id integer not null |
652
|
|
|
) |
653
|
|
|
"); |
654
|
|
|
} |
655
|
|
|
|
656
|
|
|
function update_3_5_2010() { |
657
|
|
|
do_query("alter table workunit add fileset_id integer not null"); |
658
|
|
|
} |
659
|
|
|
|
660
|
|
|
function update_3_17_2010() { |
661
|
|
|
do_query("create table host_app_version ( |
662
|
|
|
host_id integer not null, |
663
|
|
|
app_version_id integer not null, |
664
|
|
|
pfc_n double not null, |
665
|
|
|
pfc_avg double not null, |
666
|
|
|
et_n double not null, |
667
|
|
|
et_avg double not null, |
668
|
|
|
et_var double not null, |
669
|
|
|
et_q double not null, |
670
|
|
|
host_scale_time double not null, |
671
|
|
|
scale_probation tinyint not null default 1, |
672
|
|
|
error_rate double not null, |
673
|
|
|
max_jobs_per_day integer not null, |
674
|
|
|
n_jobs_today integer not null, |
675
|
|
|
turnaround_n double not null, |
676
|
|
|
turnaround_avg double not null, |
677
|
|
|
turnaround_var double not null, |
678
|
|
|
turnaround_q double not null |
679
|
|
|
) engine = InnoDB |
680
|
|
|
"); |
681
|
|
|
do_query("alter table host_app_version |
682
|
|
|
add unique hap(host_id, app_version_id) |
683
|
|
|
"); |
684
|
|
|
do_query("alter table app_version |
685
|
|
|
add pfc_n double not null default 0, |
686
|
|
|
add pfc_avg double not null default 0, |
687
|
|
|
add pfc_scale double not null default 0, |
688
|
|
|
add expavg_credit double not null default 0, |
689
|
|
|
add expavg_time double not null default 0 |
690
|
|
|
"); |
691
|
|
|
do_query("alter table app |
692
|
|
|
add min_avg_pfc double not null default 1, |
693
|
|
|
add host_scale_check tinyint not null, |
694
|
|
|
add max_jobs_in_progress integer not null, |
695
|
|
|
add max_gpu_jobs_in_progress integer not null, |
696
|
|
|
add max_jobs_per_rpc integer not null, |
697
|
|
|
add max_jobs_per_day_init integer not null |
698
|
|
|
"); |
699
|
|
|
} |
700
|
|
|
|
701
|
|
|
function update_4_21_2010() { |
702
|
|
|
do_query("alter table host_app_version |
703
|
|
|
drop column host_scale_time, |
704
|
|
|
drop column scale_probation, |
705
|
|
|
drop column error_rate, |
706
|
|
|
add column consecutive_valid integer not null |
707
|
|
|
"); |
708
|
|
|
} |
709
|
|
|
|
710
|
|
|
function update_6_10_2010() { |
711
|
|
|
do_query("alter table app |
712
|
|
|
drop column max_jobs_in_progress, |
713
|
|
|
drop column max_gpu_jobs_in_progress, |
714
|
|
|
drop column max_jobs_per_rpc, |
715
|
|
|
drop column max_jobs_per_day_init |
716
|
|
|
"); |
717
|
|
|
} |
718
|
|
|
|
719
|
|
|
function update_6_3_2011() { |
720
|
|
|
do_query("alter table app |
721
|
|
|
add homogeneous_app_version tinyint not null default 0 |
722
|
|
|
"); |
723
|
|
|
do_query("alter table workunit |
724
|
|
|
add app_version_id integer not null default 0 |
725
|
|
|
"); |
726
|
|
|
} |
727
|
|
|
|
728
|
|
|
function update_6_20_2011() { |
729
|
|
|
do_query(" |
730
|
|
|
create table batch ( |
731
|
|
|
id serial primary key, |
732
|
|
|
user_id integer not null, |
733
|
|
|
create_time integer not null, |
734
|
|
|
logical_start_time double not null, |
735
|
|
|
logical_end_time double not null, |
736
|
|
|
est_completion_time double not null, |
737
|
|
|
njobs integer not null |
738
|
|
|
) engine = InnoDB"); |
739
|
|
|
|
740
|
|
|
do_query(" |
741
|
|
|
create table user_submit ( |
742
|
|
|
user_id integer not null, |
743
|
|
|
quota double not null, |
744
|
|
|
logical_start_time double not null, |
745
|
|
|
all_apps tinyint not null |
746
|
|
|
) engine = InnoDB"); |
747
|
|
|
|
748
|
|
|
do_query(" |
749
|
|
|
create table user_submit_app ( |
750
|
|
|
user_id integer not null, |
751
|
|
|
app_id integer not null |
752
|
|
|
) engine = InnoDB"); |
753
|
|
|
} |
754
|
|
|
|
755
|
|
|
function update_7_26_2011() { |
756
|
|
|
do_query(" |
757
|
|
|
alter table batch |
758
|
|
|
add fraction_done double not null, |
759
|
|
|
add nerror_jobs integer not null, |
760
|
|
|
add state integer not null, |
761
|
|
|
add completion_time double not null, |
762
|
|
|
add credit_estimate double not null, |
763
|
|
|
add credit_canonical double not null, |
764
|
|
|
add credit_total double not null, |
765
|
|
|
add name varchar(255) not null, |
766
|
|
|
add app_id integer not null |
767
|
|
|
"); |
768
|
|
|
} |
769
|
|
|
|
770
|
|
|
function update_9_6_2011() { |
771
|
|
|
do_query(" |
772
|
|
|
alter table user_submit |
773
|
|
|
add create_apps tinyint not null, |
774
|
|
|
add create_app_versions tinyint not null |
775
|
|
|
"); |
776
|
|
|
} |
777
|
|
|
|
778
|
|
|
function update_9_15_2011() { |
779
|
|
|
do_query(" |
780
|
|
|
alter table result |
781
|
|
|
add runtime_outlier tinyint not null |
782
|
|
|
"); |
783
|
|
|
} |
784
|
|
|
|
785
|
|
|
function update_9_20_2011() { |
786
|
|
|
do_query(" |
787
|
|
|
alter table user_submit |
788
|
|
|
drop column all_apps, |
789
|
|
|
drop column create_apps, |
790
|
|
|
drop column create_app_versions, |
791
|
|
|
add submit_all tinyint not null, |
792
|
|
|
add manage_all tinyint not null |
793
|
|
|
"); |
794
|
|
|
|
795
|
|
|
do_query(" |
796
|
|
|
alter table user_submit_app |
797
|
|
|
add manage tinyint not null |
798
|
|
|
"); |
799
|
|
|
} |
800
|
|
|
|
801
|
|
|
function update_1_30_2012() { |
802
|
|
|
do_query(" |
803
|
|
|
alter table workunit |
804
|
|
|
add transitioner_flags tinyint not null |
805
|
|
|
"); |
806
|
|
|
do_query( |
807
|
|
|
"alter table assignment add index asgn_target(target_type, target_id)" |
808
|
|
|
); |
809
|
|
|
} |
810
|
|
|
|
811
|
|
|
function update_6_4_2012() { |
812
|
|
|
do_query(" |
813
|
|
|
alter table batch |
814
|
|
|
add project_state integer not null, |
815
|
|
|
add description varchar(255) not null |
816
|
|
|
"); |
817
|
|
|
} |
818
|
|
|
|
819
|
|
|
function update_8_24_2012() { |
820
|
|
|
do_query(" |
821
|
|
|
alter table app |
822
|
|
|
add non_cpu_intensive tinyint not null default 0 |
823
|
|
|
"); |
824
|
|
|
} |
825
|
|
|
|
826
|
|
|
function update_8_26_2012() { |
827
|
|
|
do_query(" |
828
|
|
|
alter table app |
829
|
|
|
add locality_scheduling integer not null default 0 |
830
|
|
|
"); |
831
|
|
|
} |
832
|
|
|
|
833
|
|
|
function update_11_25_2012() { |
834
|
|
|
do_query(" |
835
|
|
|
create table job_file ( |
836
|
|
|
id integer not null auto_increment, |
837
|
|
|
md5 char(64) not null, |
838
|
|
|
create_time double not null, |
839
|
|
|
delete_time double not null, |
840
|
|
|
primary key(id) |
841
|
|
|
) engine = InnoDB |
842
|
|
|
"); |
843
|
|
|
do_query(" |
844
|
|
|
alter table job_file add index md5 (md5) |
845
|
|
|
"); |
846
|
|
|
} |
847
|
|
|
|
848
|
|
|
function update_4_26_2013() { |
849
|
|
|
do_query("alter table app add n_size_classes smallint not null default 0"); |
850
|
|
|
do_query("alter table workunit add size_class smallint not null default -1"); |
851
|
|
|
do_query("alter table result add size_class smallint not null default -1"); |
852
|
|
|
} |
853
|
|
|
|
854
|
|
|
function update_5_23_2013() { |
855
|
|
|
do_query("alter table host add product_name varchar(254) not null"); |
856
|
|
|
} |
857
|
|
|
|
858
|
|
|
function update_9_10_2013() { |
859
|
|
|
do_query("alter table workunit change mod_time mod_time timestamp default current_timestamp on update current_timestamp"); |
860
|
|
|
do_query("alter table result change mod_time mod_time timestamp default current_timestamp on update current_timestamp"); |
861
|
|
|
} |
862
|
|
|
|
863
|
|
|
function update_9_17_2013() { |
864
|
|
|
do_query("alter table batch add expire_time double not null"); |
865
|
|
|
} |
866
|
|
|
|
867
|
|
|
function update_12_22_2013() { |
868
|
|
|
do_query(" |
869
|
|
|
create table badge ( |
870
|
|
|
id serial primary key, |
871
|
|
|
create_time double not null, |
872
|
|
|
type tinyint not null, |
873
|
|
|
name varchar(255) not null, |
874
|
|
|
title varchar(255) not null, |
875
|
|
|
description varchar(255) not null, |
876
|
|
|
image_url varchar(255) not null, |
877
|
|
|
level varchar(255) not null, |
878
|
|
|
tags varchar(255) not null, |
879
|
|
|
sql_rule varchar(255) not null |
880
|
|
|
) |
881
|
|
|
"); |
882
|
|
|
do_query(" |
883
|
|
|
create table badge_user ( |
884
|
|
|
badge_id integer not null, |
885
|
|
|
user_id integer not null, |
886
|
|
|
create_time double not null, |
887
|
|
|
reassign_time double not null |
888
|
|
|
) |
889
|
|
|
"); |
890
|
|
|
do_query(" |
891
|
|
|
create table badge_team ( |
892
|
|
|
badge_id integer not null, |
893
|
|
|
team_id integer not null, |
894
|
|
|
create_time double not null, |
895
|
|
|
reassign_time double not null |
896
|
|
|
) |
897
|
|
|
"); |
898
|
|
|
do_query(" |
899
|
|
|
alter table badge_user |
900
|
|
|
add unique (user_id, badge_id) |
901
|
|
|
"); |
902
|
|
|
do_query(" |
903
|
|
|
alter table badge_team |
904
|
|
|
add unique (team_id, badge_id) |
905
|
|
|
"); |
906
|
|
|
} |
907
|
|
|
|
908
|
|
|
function update_1_13_2014() { |
909
|
|
|
do_query( |
910
|
|
|
"alter table user_submit add max_jobs_in_progress integer not null" |
911
|
|
|
); |
912
|
|
|
} |
913
|
|
|
|
914
|
|
|
function update_3_6_2014() { |
915
|
|
|
do_query( |
916
|
|
|
"alter table host add gpu_active_frac double not null" |
917
|
|
|
); |
918
|
|
|
} |
919
|
|
|
|
920
|
|
|
function update_4_2_2014() { |
921
|
|
|
do_query( |
922
|
|
|
"alter table result |
923
|
|
|
add peak_working_set_size double not null, |
924
|
|
|
add peak_swap_size double not null, |
925
|
|
|
add peak_disk_usage double not null |
926
|
|
|
" |
927
|
|
|
); |
928
|
|
|
} |
929
|
|
|
|
930
|
|
|
function update_5_3_2014() { |
931
|
|
|
do_query( |
932
|
|
|
"alter table app |
933
|
|
|
add fraction_done_exact tinyint not null |
934
|
|
|
" |
935
|
|
|
); |
936
|
|
|
} |
937
|
|
|
|
938
|
|
|
function update_6_5_2014() { |
939
|
|
|
do_query( |
940
|
|
|
"alter table app_version |
941
|
|
|
add beta tinyint not null |
942
|
|
|
" |
943
|
|
|
); |
944
|
|
|
} |
945
|
|
|
|
946
|
|
|
function update_8_15_2014() { |
947
|
|
|
do_query( |
948
|
|
|
"create table credit_user ( |
949
|
|
|
userid integer not null, |
950
|
|
|
appid integer not null, |
951
|
|
|
njobs integer not null, |
952
|
|
|
total double not null, |
953
|
|
|
expavg double not null, |
954
|
|
|
expavg_time double not null, |
955
|
|
|
credit_type integer not null, |
956
|
|
|
primary key (userid, appid, credit_type) |
957
|
|
|
) engine=InnoDB |
958
|
|
|
" |
959
|
|
|
); |
960
|
|
|
do_query( |
961
|
|
|
"create table credit_team ( |
962
|
|
|
teamid integer not null, |
963
|
|
|
appid integer not null, |
964
|
|
|
njobs integer not null, |
965
|
|
|
total double not null, |
966
|
|
|
expavg double not null, |
967
|
|
|
expavg_time double not null, |
968
|
|
|
credit_type integer not null, |
969
|
|
|
primary key (teamid, appid, credit_type) |
970
|
|
|
) engine=InnoDB |
971
|
|
|
" |
972
|
|
|
); |
973
|
|
|
} |
974
|
|
|
|
975
|
|
|
function update_10_8_2014() { |
976
|
|
|
do_query("alter table user_submit add primary key(user_id)"); |
977
|
|
|
do_query("alter table user_submit_app add primary key(user_id, app_id)"); |
978
|
|
|
} |
979
|
|
|
|
980
|
|
|
function update_4_15_2015() { |
981
|
|
|
do_query("alter table forum |
982
|
|
|
alter timestamp set default 0, |
983
|
|
|
alter threads set default 0, |
984
|
|
|
alter posts set default 0, |
985
|
|
|
alter rate_min_expavg_credit set default 0, |
986
|
|
|
alter rate_min_total_credit set default 0, |
987
|
|
|
alter post_min_interval set default 0, |
988
|
|
|
alter post_min_expavg_credit set default 0, |
989
|
|
|
alter post_min_total_credit set default 0, |
990
|
|
|
alter parent_type set default 0 |
991
|
|
|
"); |
992
|
|
|
} |
993
|
|
|
|
994
|
|
|
// functions to change select ID types to 64-bit |
995
|
|
|
// |
996
|
|
|
function result_big_ids() { |
997
|
|
|
do_query("alter table result |
998
|
|
|
change column id id bigint not null auto_increment |
999
|
|
|
"); |
1000
|
|
|
do_query("alter table workunit |
1001
|
|
|
change column canonical_resultid canonical_resultid bigint not null |
1002
|
|
|
"); |
1003
|
|
|
do_query("alter table assignment |
1004
|
|
|
change column resultid resultid bigint not null |
1005
|
|
|
"); |
1006
|
|
|
} |
1007
|
|
|
|
1008
|
|
|
function workunit_big_ids() { |
1009
|
|
|
do_query("alter table workunit |
1010
|
|
|
change column id id bigint not null auto_increment |
1011
|
|
|
"); |
1012
|
|
|
do_query("alter table result |
1013
|
|
|
change column workunitid workunitid bigint not null |
1014
|
|
|
"); |
1015
|
|
|
do_query("alter table assignment |
1016
|
|
|
change column workunitid workunitid bigint not null |
1017
|
|
|
"); |
1018
|
|
|
} |
1019
|
|
|
|
1020
|
|
|
// run this if your projects uses HTTPS, to patch up the gravatar URLs |
1021
|
|
|
// |
1022
|
|
|
function gravatar_update() { |
1023
|
|
|
do_query("update forum_preferences |
1024
|
|
|
SET avatar = REPLACE(avatar, 'http://www.gravatar.com', '//www.gravatar.com') |
1025
|
|
|
"); |
1026
|
|
|
} |
1027
|
|
|
|
1028
|
|
|
function update_1_27_2016() { |
1029
|
|
|
do_query("alter table team add column mod_time timestamp default current_timestamp on update current_timestamp"); |
1030
|
|
|
} |
1031
|
|
|
|
1032
|
|
|
function update_2_17_2017() { |
1033
|
|
|
do_query("alter table job_file change md5 name varchar(255) not null"); |
1034
|
|
|
} |
1035
|
|
|
|
1036
|
|
|
function update_3_17_2017() { |
1037
|
|
|
do_query("alter table credit_user |
1038
|
|
|
add index cu_total(appid, total), |
1039
|
|
|
add index cu_avg(appid, expavg) |
1040
|
|
|
"); |
1041
|
|
|
do_query("alter table credit_team |
1042
|
|
|
add index ct_total(appid, total), |
1043
|
|
|
add index ct_avg(appid, expavg) |
1044
|
|
|
"); |
1045
|
|
|
} |
1046
|
|
|
|
1047
|
|
|
function update_6_13_2017() { |
1048
|
|
|
do_query("alter table host |
1049
|
|
|
add column p_ngpus integer not null, |
1050
|
|
|
add column p_gpu_fpops double not null |
1051
|
|
|
"); |
1052
|
|
|
} |
1053
|
|
|
|
1054
|
|
|
function update_7_21_2017() { |
1055
|
|
|
do_query("alter table workunit |
1056
|
|
|
add column keywords varchar(254) not null |
1057
|
|
|
"); |
1058
|
|
|
} |
1059
|
|
|
|
1060
|
|
|
function update_8_9_2017() { |
1061
|
|
|
do_query("alter table workunit |
1062
|
|
|
add column app_version_num integer not null |
1063
|
|
|
"); |
1064
|
|
|
} |
1065
|
|
|
|
1066
|
|
|
function update_10_25_2017() { |
1067
|
|
|
do_query("alter table user |
1068
|
|
|
add column login_token char(32) not null, |
1069
|
|
|
add column login_token_time double not null |
1070
|
|
|
"); |
1071
|
|
|
} |
1072
|
|
|
|
1073
|
|
|
function update_3_8_2018() { |
1074
|
|
|
do_query("alter table user |
1075
|
|
|
modify column login_token char(32) not null default '', |
1076
|
|
|
modify column login_token_time double not null default 0 |
1077
|
|
|
"); |
1078
|
|
|
} |
1079
|
|
|
|
1080
|
|
|
function update_4_5_2018() { |
1081
|
|
|
do_query("create table token ( |
1082
|
|
|
token varchar(255) not null, |
1083
|
|
|
userid integer not null, |
1084
|
|
|
type char not null, |
1085
|
|
|
create_time integer not null, |
1086
|
|
|
expire_time integer, |
1087
|
|
|
primary key (token), |
1088
|
|
|
index token_userid (userid) |
1089
|
|
|
) engine=InnoDB |
1090
|
|
|
"); |
1091
|
|
|
} |
1092
|
|
|
|
1093
|
|
|
function update_4_6_2018() { |
1094
|
|
|
do_query("alter table team |
1095
|
|
|
modify column total_credit double not null default 0.0, |
1096
|
|
|
modify column expavg_credit double not null default 0.0, |
1097
|
|
|
modify column seti_id integer not null default 0 |
1098
|
|
|
"); |
1099
|
|
|
} |
1100
|
|
|
|
1101
|
|
|
function update_4_18_2018() { |
1102
|
|
|
do_query("alter table token |
1103
|
|
|
modify column create_time integer not null |
1104
|
|
|
"); |
1105
|
|
|
} |
1106
|
|
|
|
1107
|
|
|
function update_4_19_2018() { |
1108
|
|
|
do_query("alter table user |
1109
|
|
|
add column previous_email_addr varchar(254) not null default '', |
1110
|
|
|
add column email_addr_change_time double not null default 0 |
1111
|
|
|
"); |
1112
|
|
|
do_query("alter table user add index user_email_time (email_addr_change_time)"); |
1113
|
|
|
} |
1114
|
|
|
|
1115
|
|
|
function update_5_9_2018() { |
1116
|
|
|
$retval = do_query("create table user_deleted ( |
1117
|
|
|
userid integer not null, |
1118
|
|
|
public_cross_project_id varchar(254) not null, |
1119
|
|
|
create_time double not null, |
1120
|
|
|
primary key (userid) |
1121
|
|
|
) engine=InnoDB; |
1122
|
|
|
"); |
1123
|
|
|
|
1124
|
|
|
$retval = $retval && do_query("create table host_deleted ( |
1125
|
|
|
hostid integer not null, |
1126
|
|
|
public_cross_project_id varchar(254) not null, |
1127
|
|
|
create_time double not null, |
1128
|
|
|
primary key (hostid) |
1129
|
|
|
) engine=InnoDB; |
1130
|
|
|
"); |
1131
|
|
|
|
1132
|
|
|
$retval = $retval && do_query("alter table user_deleted |
1133
|
|
|
add index user_deleted_create(create_time) |
1134
|
|
|
"); |
1135
|
|
|
|
1136
|
|
|
$retval = $retval && do_query("alter table host_deleted |
1137
|
|
|
add index host_deleted_create(create_time) |
1138
|
|
|
"); |
1139
|
|
|
|
1140
|
|
|
$retval = $retval && do_query("alter table team_delta |
1141
|
|
|
add index team_delta_userid (userid) |
1142
|
|
|
"); |
1143
|
|
|
|
1144
|
|
|
$retval = $retval && do_query("alter table donation_paypal |
1145
|
|
|
add index donation_paypal_userid(userid) |
1146
|
|
|
"); |
1147
|
|
|
|
1148
|
|
|
$retval = $retval && do_query("alter table banishment_vote |
1149
|
|
|
add index banishment_vote_userid(userid) |
1150
|
|
|
"); |
1151
|
|
|
|
1152
|
|
|
$retval = $retval && do_query("alter table post_ratings |
1153
|
|
|
add index post_ratings_user(user) |
1154
|
|
|
"); |
1155
|
|
|
|
1156
|
|
|
$retval = $retval && do_query("alter table msg_from_host |
1157
|
|
|
add index message_hostid(hostid) |
1158
|
|
|
"); |
1159
|
|
|
|
1160
|
|
|
return $retval && do_query("alter table sent_email |
1161
|
|
|
add index sent_email_userid(userid) |
1162
|
|
|
"); |
1163
|
|
|
} |
1164
|
|
|
|
1165
|
|
|
function update_8_23_2018() { |
1166
|
|
|
$retval = do_query("alter table host add index host_userid_cpid (userid, host_cpid)"); |
1167
|
|
|
$retval = $retval && do_query("alter table host drop index host_user"); |
1168
|
|
|
return $retval && do_query("alter table host add index host_domain_name (domain_name)"); |
1169
|
|
|
} |
1170
|
|
|
|
1171
|
|
|
|
1172
|
|
|
function update_9_12_2018() { |
1173
|
|
|
do_query("create table consent ( |
1174
|
|
|
id integer not null auto_increment, |
1175
|
|
|
userid integer not null, |
1176
|
|
|
consent_type_id integer not null, |
1177
|
|
|
consent_time integer not null, |
1178
|
|
|
consent_flag tinyint not null, |
1179
|
|
|
consent_not_required tinyint not null, |
1180
|
|
|
source varchar(255) not null, |
1181
|
|
|
primary key (id), |
1182
|
|
|
index userid_ctid(userid, consent_type_id), |
1183
|
|
|
index consent_timestamp(consent_time), |
1184
|
|
|
index flag_ctid(consent_flag, consent_type_id) |
1185
|
|
|
) engine=InnoDB; |
1186
|
|
|
"); |
1187
|
|
|
|
1188
|
|
|
do_query("create table consent_type ( |
1189
|
|
|
id integer not null auto_increment, |
1190
|
|
|
shortname varchar(255) not null, |
1191
|
|
|
description varchar(255) not null, |
1192
|
|
|
enabled integer not null, |
1193
|
|
|
project_specific integer not null, |
1194
|
|
|
privacypref integer not null, |
1195
|
|
|
primary key (id), |
1196
|
|
|
index consent_name (shortname) |
1197
|
|
|
) engine=InnoDB; |
1198
|
|
|
"); |
1199
|
|
|
|
1200
|
|
|
do_query("alter table consent |
1201
|
|
|
add foreign key(consent_type_id) |
1202
|
|
|
references consent_type(id) |
1203
|
|
|
on update cascade |
1204
|
|
|
on delete restrict; |
1205
|
|
|
"); |
1206
|
|
|
|
1207
|
|
|
do_query("insert into consent_type |
1208
|
|
|
(shortname, description, enabled, project_specific, privacypref) values |
1209
|
|
|
('ENROLL', 'General terms-of-use for this BOINC project.', 0, 0, 0); |
1210
|
|
|
"); |
1211
|
|
|
do_query("insert into consent_type |
1212
|
|
|
(shortname, description, enabled, project_specific, privacypref) values |
1213
|
|
|
('STATSEXPORT', 'Do you consent to exporting your data to BOINC statistics aggregation Web sites?', 0, 0, 1); |
1214
|
|
|
"); |
1215
|
|
|
|
1216
|
|
|
// SQL View representing the latest consent state of users for all |
1217
|
|
|
// consent_types. Used in sched/db_dump and Web site preferences to |
1218
|
|
|
// determine if a user has consented to a particular consent type. |
1219
|
|
|
do_query("create view latest_consent as |
1220
|
|
|
SELECT userid, |
1221
|
|
|
consent_type_id, |
1222
|
|
|
consent_flag |
1223
|
|
|
FROM consent |
1224
|
|
|
WHERE NOT EXISTS |
1225
|
|
|
(SELECT * |
1226
|
|
|
FROM consent AS filter |
1227
|
|
|
WHERE consent.userid = filter.userid |
1228
|
|
|
AND consent.consent_type_id = filter.consent_type_id |
1229
|
|
|
AND filter.consent_time > consent.consent_time); |
1230
|
|
|
"); |
1231
|
|
|
} |
1232
|
|
|
|
1233
|
|
|
function update_2_15_2025() { |
1234
|
|
|
do_query('alter table result drop index res_wu_user'); |
1235
|
|
|
do_query('alter table workunit add index wu_batch(batch)'); |
1236
|
|
|
do_query('alter table result add index res_batch(batch)'); |
1237
|
|
|
} |
1238
|
|
|
|
1239
|
|
|
// Updates are done automatically if you use "upgrade". |
1240
|
|
|
// |
1241
|
|
|
// If you need to do updates manually, |
1242
|
|
|
// modify the following to call the function you want. |
1243
|
|
|
// Make sure you do all needed functions, in order. |
1244
|
|
|
// (Look at your DB structure using "explain" queries to see |
1245
|
|
|
// which ones you need). |
1246
|
|
|
|
1247
|
|
|
//update_3_17_2010(); |
1248
|
|
|
|
1249
|
|
|
// in the following, the first element is a version number. |
1250
|
|
|
// This used to be the Subversion version#, |
1251
|
|
|
// but with Git we just use sequential integers |
1252
|
|
|
// |
1253
|
|
|
$db_updates = array ( |
|
|
|
|
1254
|
|
|
array(18490, "update_6_16_2009"), |
1255
|
|
|
array(19001, "update_9_3_2009"), |
1256
|
|
|
array(20807, "update_3_5_2010"), |
1257
|
|
|
array(20932, "update_3_17_2010"), |
1258
|
|
|
array(21226, "update_4_21_2010"), |
1259
|
|
|
array(21728, "update_6_10_2010"), |
1260
|
|
|
array(23635, "update_6_3_2011"), |
1261
|
|
|
array(23762, "update_6_20_2011"), |
1262
|
|
|
array(23881, "update_7_26_2011"), |
1263
|
|
|
array(24137, "update_9_6_2011"), |
1264
|
|
|
array(24225, "update_9_15_2011"), |
1265
|
|
|
array(24248, "update_9_20_2011"), |
1266
|
|
|
array(25169, "update_1_30_2012"), |
1267
|
|
|
array(25734, "update_6_4_2012"), |
1268
|
|
|
array(26060, "update_8_24_2012"), |
1269
|
|
|
array(26062, "update_8_26_2012"), |
1270
|
|
|
array(27000, "update_11_25_2012"), |
1271
|
|
|
array(27001, "update_4_26_2013"), |
1272
|
|
|
array(27002, "update_5_23_2013"), |
1273
|
|
|
array(27003, "update_9_10_2013"), |
1274
|
|
|
array(27004, "update_9_17_2013"), |
1275
|
|
|
array(27005, "update_12_22_2013"), |
1276
|
|
|
array(27006, "update_1_13_2014"), |
1277
|
|
|
array(27007, "update_3_6_2014"), |
1278
|
|
|
array(27008, "update_4_2_2014"), |
1279
|
|
|
array(27009, "update_5_3_2014"), |
1280
|
|
|
array(27010, "update_6_5_2014"), |
1281
|
|
|
array(27011, "update_8_15_2014"), |
1282
|
|
|
array(27012, "update_10_8_2014"), |
1283
|
|
|
array(27013, "update_4_15_2015"), |
1284
|
|
|
array(27014, "update_1_27_2016"), |
1285
|
|
|
array(27015, "update_2_17_2017"), |
1286
|
|
|
array(27016, "update_3_17_2017"), |
1287
|
|
|
array(27017, "update_6_13_2017"), |
1288
|
|
|
array(27018, "update_7_21_2017"), |
1289
|
|
|
array(27019, "update_8_9_2017"), |
1290
|
|
|
array(27020, "update_10_25_2017"), |
1291
|
|
|
array(27021, "update_3_8_2018"), |
1292
|
|
|
array(27022, "update_4_5_2018"), |
1293
|
|
|
array(27023, "update_4_6_2018"), |
1294
|
|
|
array(27024, "update_4_18_2018"), |
1295
|
|
|
array(27025, "update_4_19_2018"), |
1296
|
|
|
array(27026, "update_5_9_2018"), |
1297
|
|
|
array(27027, "update_8_23_2018"), |
1298
|
|
|
array(27028, "update_9_12_2018"), |
1299
|
|
|
array(27029, "update_2_15_2025"), |
1300
|
|
|
); |
1301
|
|
|
|
1302
|
|
|
?> |
1303
|
|
|
|