2004-04-18 18:40:13 +00:00
#! /usr/local/bin/php
< ? php
// code for one-time database updates goes here.
// Don't run this unless you know what you're doing!
2004-04-20 05:10:40 +00:00
require_once ( " ../inc/db.inc " );
2004-04-18 18:40:13 +00:00
require_once ( " ../inc/util.inc " );
2004-05-27 18:13:00 +00:00
db_init ();
2004-04-18 18:40:13 +00:00
function update_4_18_2004 () {
mysql_query ( " alter table user add cross_project_id varchar(254) not null " );
$result = mysql_query ( " select * from user " );
while ( $user = mysql_fetch_object ( $result )) {
$x = random_string ();
mysql_query ( " update user set cross_project_id=' $x ' where id= $user->id " );
}
}
2004-05-12 22:16:46 +00:00
function update_5_12_2004 () {
mysql_query (
" create table trickle_up (
id integer not null auto_increment ,
create_time integer not null ,
send_time integer not null ,
resultid integer not null ,
appid integer not null ,
hostid integer not null ,
handled smallint not null ,
xml text ,
primary key ( id )
) "
);
mysql_query (
" create table trickle_down (
id integer not null auto_increment ,
create_time integer not null ,
resultid integer not null ,
hostid integer not null ,
handled smallint not null ,
xml text ,
primary key ( id )
) "
);
mysql_query (
" alter table trickle_up add index trickle_handled (appid, handled) "
);
mysql_query (
" alter table trickle_down add index trickle_host(hostid, handled) "
);
}
2004-05-27 18:13:00 +00:00
function update_5_27_2004 () {
mysql_query (
" alter table host add nresults_today integer not null "
);
}
2004-06-09 21:42:23 +00:00
function update_6_9_2004 () {
mysql_query (
" alter table profile change verification verification integer not null "
);
}
2004-06-16 19:10:24 +00:00
function update_6_15_2004 () {
mysql_query (
" alter table user add index user_name(name) "
);
}
2004-06-09 21:42:23 +00:00
2004-07-02 19:17:53 +00:00
function update_7_02_2004 () {
mysql_query (
" alter table workunit drop column result_template "
);
mysql_query (
" alter table workunit add column result_template_file varchar(63) not null "
);
mysql_query (
" update workunit set result_template_file='templates/foo.xml' "
);
}
2004-07-08 19:20:19 +00:00
function update_7_08_2004 () {
mysql_query (
" alter table result drop index ind_res_st "
);
mysql_query (
" alter table add index ind_res_st(server_state) "
);
}
2004-09-04 23:37:49 +00:00
function update_9_04_2004 () {
mysql_query (
" insert into forum_preferences (userid, signature, posts) select user.id, user.signature, user.posts from user where user.posts > 0 or user.signature<>'' " );
}
2004-09-05 19:26:27 +00:00
function update_9_05_2004 () {
mysql_query (
" ALTER TABLE forum_preferences ADD special_user INT NOT NULL "
);
}
//update_9_05_2004();
2004-04-18 18:40:13 +00:00
?>