From b0199b263fe0d7f156fe0fc8c25d9f785b56a26e Mon Sep 17 00:00:00 2001 From: bettina Date: Fri, 27 Apr 2001 16:02:59 +0000 Subject: [PATCH] added cat_main plus cat_level to phpgw_categories --- setup/sql/mysql_newtables.inc.php | 4 +++- setup/sql/mysql_upgrade_beta.inc.php | 12 +++++++++++ setup/sql/pgsql_newtables.inc.php | 6 ++++-- setup/sql/pgsql_upgrade_beta.inc.php | 30 ++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/setup/sql/mysql_newtables.inc.php b/setup/sql/mysql_newtables.inc.php index d511f89953..ff6465aa6b 100644 --- a/setup/sql/mysql_newtables.inc.php +++ b/setup/sql/mysql_newtables.inc.php @@ -304,7 +304,9 @@ $sql = "CREATE TABLE phpgw_categories ( cat_id int(9) DEFAULT '0' NOT NULL auto_increment, + cat_main int(9) DEFAULT '0' NOT NULL, cat_parent int(9) DEFAULT '0' NOT NULL, + cat_level int(3) DEFAULT '0' NOT NULL, cat_owner int(11) DEFAULT '0' NOT NULL, cat_access char(7), cat_appname varchar(50) NOT NULL, @@ -350,7 +352,7 @@ )"; $phpgw_setup->db->query($sql); - $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.002'; + $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.003'; $phpgw_info['setup']['oldver']['phpgwapi'] = $phpgw_info['setup']['currentver']['phpgwapi']; update_version_table(); // $phpgw_setup->update_version_table(); diff --git a/setup/sql/mysql_upgrade_beta.inc.php b/setup/sql/mysql_upgrade_beta.inc.php index 304a2798f1..c77230ca96 100644 --- a/setup/sql/mysql_upgrade_beta.inc.php +++ b/setup/sql/mysql_upgrade_beta.inc.php @@ -1561,6 +1561,18 @@ $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.002'; } + $test[] = '0.9.11.002'; + function upgrade0_9_11_002() + { + global $phpgw_info,$phpgw_setup; + + $phpgw_setup->db->query("alter table phpgw_categories add column cat_main int(9) default '0' not null after cat_id",__LINE__,__FILE__); + $phpgw_setup->db->query("alter table phpgw_categories add column cat_level int(9) default '0' not null after cat_parent",__LINE__,__FILE__); + + $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.003'; + } + + reset ($test); while (list ($key, $value) = each ($test)){ if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) { diff --git a/setup/sql/pgsql_newtables.inc.php b/setup/sql/pgsql_newtables.inc.php index 7cef262245..f89f473796 100644 --- a/setup/sql/pgsql_newtables.inc.php +++ b/setup/sql/pgsql_newtables.inc.php @@ -276,7 +276,9 @@ $sql = "CREATE TABLE phpgw_categories ( cat_id serial, - cat_parent int, + cat_main int, + cat_parent int DEFAULT 0, + cat_level int DEFAULT 0, cat_owner int, cat_access char(7), cat_appname varchar(50) NOT NULL, @@ -318,7 +320,7 @@ )"; $phpgw_setup->db->query($sql); - $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.002'; + $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.003'; $phpgw_info['setup']['oldver']['phpgwapi'] = $phpgw_info['setup']['currentver']['phpgwapi']; update_version_table(); ?> diff --git a/setup/sql/pgsql_upgrade_beta.inc.php b/setup/sql/pgsql_upgrade_beta.inc.php index e140863d0d..b864fe7a98 100644 --- a/setup/sql/pgsql_upgrade_beta.inc.php +++ b/setup/sql/pgsql_upgrade_beta.inc.php @@ -1989,6 +1989,36 @@ $phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.11.002'; } + $test[] = '0.9.11.002'; + function upgrade0_9_11_002() { + global $phpgw_info, $phpgw_setup; + + $phpgw_setup->db->query("create table temp as select * from phpgw_categories",__LINE__,__FILE__); + + $phpgw_setup->db->query("drop sequence phpgw_categories_cat_id_seq",__LINE__,__FILE__); + + $phpgw_setup->db->query("drop table phpgw_categories",__LINE__,__FILE__); + + $phpgw_setup->db->query("CREATE TABLE phpgw_categories ( + cat_id serial, + cat_main int, + cat_parent int DEFAULT 0, + cat_level int DEFAULT 0, + cat_owner int, + cat_access varchar(25), + cat_appname varchar(50) NOT NULL, + cat_name varchar(150) NOT NULL, + cat_description varchar(255) NOT NULL, + cat_data text + )"); + + $phpgw_setup->db->query("insert into phpgw_categories select * from temp",__LINE__,__FILE__); + + $phpgw_setup->db->query("drop table temp",__LINE__,__FILE__); + + $phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.11.003"; + } + reset ($test); while (list ($key, $value) = each ($test)){ if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) {