Cleaned up quite a bit in PostgreSQL create, upgrade and drop tables.

This commit is contained in:
jengo 2001-05-03 04:53:49 +00:00
parent b097f16f42
commit efa2d7dede
3 changed files with 30 additions and 40 deletions

View File

@ -272,7 +272,7 @@
if(ereg("([0-9]+)(pre)([0-9]+)",$ver[2],$regs))
if(($regs[1] == "10") && ($regs[3] >= "6"))
$config_table="phpgw_config";
$this->db->query("select config_value from $config_table where config_name='freshinstall'");
@$this->db->query("select config_value from $config_table where config_name='freshinstall'");
$this->db->next_record();
$configed = $this->db->f("config_value");
if ($configed){

View File

@ -11,49 +11,46 @@
/* $Id$ */
// !! NOTE !! This should ONLY contain the current tables and sequences. Do NOT remove older tables
// That are no longer being used. People might have tables matching the same names in there installs.
$phpgw_setup->db->query("DROP TABLE phpgw_config");
$phpgw_setup->db->query("DROP TABLE phpgw_applications");
$phpgw_setup->db->query("drop sequence phpgw_accounts_account_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_accounts");
$phpgw_setup->db->query("drop sequence phpgw_accounts_account_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_preferences");
$phpgw_setup->db->query("DROP TABLE phpgw_sessions");
$phpgw_setup->db->query("DROP TABLE phpgw_app_sessions");
$phpgw_setup->db->query("DROP TABLE phpgw_acl");
$phpgw_setup->db->query("DROP TABLE phpgw_access_log");
$phpgw_setup->db->query("drop sequence phpgw_categories_cat_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_categories");
$phpgw_setup->db->query("drop sequence profiles_con_seq");
$phpgw_setup->db->query("drop sequence phpgw_hooks_hook_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_hooks");
$phpgw_setup->db->query("DROP TABLE profiles");
$phpgw_setup->db->query("DROP TABLE addressbook");
$phpgw_setup->db->query("drop sequence addressbook_id_seq");
$phpgw_setup->db->query("drop sequence phpgw_addressbook_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_categories");
$phpgw_setup->db->query("drop sequence phpgw_categories_cat_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_hooks");
$phpgw_setup->db->query("drop sequence phpgw_hooks_hook_id_seq");
$phpgw_setup->db->query("DROP TABLE profiles");
$phpgw_setup->db->query("drop sequence profiles_con_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_addressbook");
$phpgw_setup->db->query("DROP TABLE phpgw_addressbook_extra");
$phpgw_setup->db->query("DROP TABLE phpgw_cal");
$phpgw_setup->db->query("drop sequence phpgw_addressbook_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_cal_user");
$phpgw_setup->db->query("DROP TABLE phpgw_cal_repeats");
$phpgw_setup->db->query("DROP TABLE phpgw_cal_holidays");
$phpgw_setup->db->query("drop sequence phpgw_cal_holidays_hol_id_seq");
$phpgw_setup->db->query("drop sequence phpgw_cal_cal_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_nextid");
$phpgw_setup->db->query("drop sequence todo_todo_id_seq");
$phpgw_setup->db->query("DROP TABLE todo");
$phpgw_setup->db->query("DROP TABLE phpgw_todo");
$phpgw_setup->db->query("DROP sequence phpgw_todo_id_seq");
$phpgw_setup->db->query("DROP sequence phpgw_todo_todo_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_cal");
$phpgw_setup->db->query("DROP TABLE phpgw_cal_user");
$phpgw_setup->db->query("DROP TABLE phpgw_cal_repeats");
@$phpgw_setup->db->query("DROP TABLE calendar_entry");
@$phpgw_setup->db->query("DROP TABLE calendar_entry_user");
@$phpgw_setup->db->query("DROP TABLE calendar_entry_repeats");
$phpgw_setup->db->query("DROP sequence phpgw_cal_id_seq");
$phpgw_setup->db->query("drop sequence calendar_entry_cal_id_seq");
$phpgw_setup->db->query("drop sequence newsgroups_con_seq");
$phpgw_setup->db->query("DROP TABLE newsgroups");
@ -61,19 +58,7 @@
$phpgw_setup->db->query("drop sequence news_msg_con_seq");
$phpgw_setup->db->query("DROP TABLE news_msg");
$phpgw_setup->db->query("DROP TABLE languages");
$phpgw_setup->db->query("drop sequence categories_cat_id_seq");
$phpgw_setup->db->query("DROP TABLE categories");
$phpgw_setup->db->query("DROP sequence phpgw_notes_note_id_seq");
$phpgw_setup->db->query("DROP TABLE phpgw_notes");
$phpgw_setup->db->query("DROP TABLE config");
$phpgw_setup->db->query("DROP TABLE applications");
$phpgw_setup->db->query("drop sequence groups_group_id_seq");
$phpgw_setup->db->query("DROP TABLE groups");
$phpgw_setup->db->query("drop sequence accounts_account_id_seq");
$phpgw_setup->db->query("DROP TABLE accounts");
$phpgw_setup->db->query("DROP TABLE preferences");
$phpgw_setup->db->query("DROP sequence notes_note_id_seq");
$phpgw_setup->db->query("DROP TABLE notes");
$phpgw_setup->db->query("DROP sequence phpgw_notes_note_id_seq");
?>

View File

@ -2080,7 +2080,7 @@
account_type char(1),
unique(account_lid)
)";
$phpgw_setup->db->query($sql);
$phpgw_setup->db->query($sql,__LINE__,__FILE__);
$phpgw_setup->db->query("insert into phpgw_accounts select * from phpgw_accounts_temp",__LINE__,__FILE__);
$phpgw_setup->db->query("drop table phpgw_accounts_temp",__LINE__,__FILE__);
@ -2095,6 +2095,8 @@
global $phpgw_info, $phpgw_setup;
$phpgw_setup->db->query("create table phpgw_cal_temp as select * from phpgw_cal",__LINE__,__FILE__);
$phpgw_setup->db->query("drop table phpgw_cal",__LINE__,__FILE__);
$phpgw_setup->db->query("drop sequence phpgw_cal_cal_id_seq",__LINE__,__FILE__);
$sql = "CREATE TABLE phpgw_cal (
cal_id serial,
owner int DEFAULT 0 NOT NULL,
@ -2131,6 +2133,7 @@
$phpgw_setup->db->query("drop table phpgw_cal_temp",__LINE__,__FILE__);
$phpgw_setup->db->query("drop sequence phpgw_cal_holidays_hol_id_seq",__LINE__,__FILE__);
$phpgw_setup->db->query("drop table phpgw_cal_holidays",__LINE__,__FILE__);
$sql = "CREATE TABLE phpgw_cal_holidays (
@ -2139,7 +2142,7 @@
name varchar(50) NOT NULL,
date_time int4 DEFAULT 0 NOT NULL
)";
$phpgw_setup->db->query($sql);
$phpgw_setup->db->query($sql,__LINE__,__FILE__);
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.007';
}
@ -2150,6 +2153,8 @@
global $phpgw_info, $phpgw_setup;
$phpgw_setup->db->query("drop table phpgw_cal_holidays",__LINE__,__FILE__);
$phpgw_setup->db->query("drop sequence phpgw_cal_holidays_hol_id_seq",__LINE__,__FILE__);
$sql = "CREATE TABLE phpgw_cal_holidays (
hol_id serial,
locale char(2) NOT NULL,
@ -2159,7 +2164,7 @@
occurence int DEFAULT 0,
dow int DEFAULT 0
)";
$phpgw_setup->db->query($sql);
$phpgw_setup->db->query($sql,__LINE__,__FILE__);
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.008';
}