query("alter table access_log change lo lo varchar(255)"); $db->query("alter table addressbook change ab_id ab_id int(11) NOT NULL auto_increment"); $db->query("alter table addressbook add ab_company_id int(10) unsigned"); $db->query("alter table addressbook add ab_title varchar(60)"); $db->query("alter table addressbook add ab_address2 varchar(60)"); $sql = "CREATE TABLE customers ( company_id int(10) unsigned NOT NULL auto_increment, company_name varchar(255), website varchar(80), ftpsite varchar(80), industry_type varchar(50), status varchar(30), software varchar(40), lastjobnum int(10) unsigned, lastjobfinished date, busrelationship varchar(30), notes text, PRIMARY KEY (company_id) );"; $db->query($sql); $db->query("update lang set lang='da' where lang='dk'"); $db->query("update lang set lang='ko' where lang='kr'"); $db->query("update preferences set preference_name='da' where preference_name='dk'"); $db->query("update preferences set preference_name='ko' where preference_name='kr'"); //add weather support $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('weather', 'Weather', 1, 12, NULL, '".$phpgw_info["server"]["version"]."')"); $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'weather','Weather','en','weather')"); echo " \n"; echo " Upgrade from 0.9.1 to 0.9.2 is completed.\n"; echo " \n"; $currentver = "0.9.2"; } } function update_owner($table,$field){ global $db; $db->query("select distinct($field) from $table"); if ($db->num_rows()) { while($db->next_record()) { $owner[count($owner)] = $db->f($field); } for($i=0;$iquery("select account_id from accounts where account_lid='".$owner[$i]."'"); $db->next_record(); $db->query("update $table set $field=".$db->f("account_id")." where $field='".$owner[$i]."'"); } } $db->query("alter table $table change $field $field int(11) NOT NULL"); } function v0_9_2to0_9_3() { global $currentver, $phpgw_info, $db; // The 0.9.3pre1 is only temp until release if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3" || $currentver == "0.9.3pre4" || $currentver == "0.9.3pre5" || $currentver == "0.9.3pre6") { if ($currentver == "0.9.2" || $currentver == "0.9.3pre1") { update_owner("addressbook","ab_owner"); update_owner("todo","todo_owner"); update_owner("webcal_entry","cal_create_by"); update_owner("webcal_entry_user","cal_login"); $currentver = "0.9.3pre2"; update_version_table(); } if ($currentver == "0.9.3pre2") { $db->query("select owner, newsgroup from users_newsgroups"); if ($db->num_rows()) { while($db->next_record()) { $owner[count($owner)] = $db->f("owner"); $newsgroup[count($newsgroup)] = $db->f("newsgroup"); } for ($i=0;$iquery("insert into preferences (preference_owner,preference_name," ."preference_value,preference_appname) values ('".$owner[$i]."','".$newsgroup[$i]."','True'," ."'nntp')"); } $db->query("drop table users_newsgroups"); $db->query("update applications set app_tables='newsgroups' where app_name='nntp'"); } $currentver = "0.9.3pre3"; update_version_table(); } if ($currentver == "0.9.3pre3") { $db->query("alter table todo add todo_id_parent int DEFAULT 0 NOT NULL"); $currentver = "0.9.3pre4"; update_version_table(); } if ($currentver == "0.9.3pre4") { $db->query("create table temp as select * from config"); $db->query("drop table config"); $db->query("create table config config_name varchar(255) NOT NULL UNIQUE, config_value varchar(100) NOT NULL"); $db->query("insert into config select * from temp"); $db->query("drop table config"); $currentver = "0.9.3pre5"; update_version_table(); } if ($currentver == "0.9.3pre5") { $db->query("CREATE TABLE categories ( cat_id serial, account_id int DEFAULT '0' NOT NULL, app_name varchar(25) NOT NULL, cat_name varchar(150) NOT NULL, cat_description text NOT NULL)" ); $currentver = "0.9.3pre6"; update_version_table(); } if ($currentver == "0.9.3pre6") { $db->query("alter table addressbook add ab_url varchar(255)"); $db->query("insert into applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('transy', 'Translation Management', 0, 13, NULL, '".$phpgw_info["server"]["version"]."')"); $currentver = "0.9.3pre7"; update_version_table(); } echo " \n"; echo " Upgrade from 0.9.2 to $currentver is completed.\n"; echo " \n"; } } v0_9_1to0_9_2(); v0_9_2to0_9_3(); ?>