From fb3a14134385c3fa777d252944f2094f3e05cc0b Mon Sep 17 00:00:00 2001 From: jensp Date: Tue, 16 Dec 2014 09:37:39 +0000 Subject: [PATCH] Some refinements for upgrades, especially for Oracle and upgrading old APLAWS installations (1.0.4) to current versions git-svn-id: https://svn.libreccm.org/ccm/trunk@3056 8810af33-2d31-482b-a856-94f89814c4df --- .../ren_tables_cms_publicpersonalprofile.sql | 72 ++++++++-- .../upgrade/postgres-6.6.5-6.6.6.sql | 2 +- .../upgrade/postgres-6.6.0-6.6.1.sql | 8 +- .../6.6.0-6.6.1/upd_decisiontree_tables.sql | 40 ++++++ .../src/ccm-cms-types-decisiontree.upgrade | 13 +- .../6.6.5-6.6.6/remove_legacy_entries.sql | 12 +- .../ren_tables_cms_organisation.sql | 130 +++++++----------- .../6.6.11-6.6.12/upd_table_content_types.sql | 8 +- .../upgrade/postgres-6.6.11-6.6.12.sql | 2 +- ccm-cms/src/ccm-cms.upgrade | 6 + .../remove_admin_legacy_entries.sql | 6 +- .../6.6.3-6.6.4/remove_ds_legacy_entries.sql | 6 +- .../remove_permissions_legacy_entries.sql | 10 +- .../remove_sitemap_legacy_entries.sql | 10 +- .../upgrade/oracle-se-6.6.0-6.6.1.sql | 2 +- .../6.6.1-6.6.2/remove_legacy_entries.sql | 10 +- .../default/6.6.1-6.6.2/upd_system_tables.sql | 22 +-- 17 files changed, 229 insertions(+), 130 deletions(-) create mode 100644 ccm-cms-types-decisiontree/sql/ccm-cms-types-decisiontree/upgrade/postgres/6.6.0-6.6.1/upd_decisiontree_tables.sql diff --git a/ccm-cms-publicpersonalprofile/sql/ccm-cms-publicpersonalprofile/postgres/upgrade/6.6.5-6.6.6/ren_tables_cms_publicpersonalprofile.sql b/ccm-cms-publicpersonalprofile/sql/ccm-cms-publicpersonalprofile/postgres/upgrade/6.6.5-6.6.6/ren_tables_cms_publicpersonalprofile.sql index c396b9e5b..1446ae548 100644 --- a/ccm-cms-publicpersonalprofile/sql/ccm-cms-publicpersonalprofile/postgres/upgrade/6.6.5-6.6.6/ren_tables_cms_publicpersonalprofile.sql +++ b/ccm-cms-publicpersonalprofile/sql/ccm-cms-publicpersonalprofile/postgres/upgrade/6.6.5-6.6.6/ren_tables_cms_publicpersonalprofile.sql @@ -29,20 +29,76 @@ -- * (6.6.7-6.6.8/add_personsstr_column.sql) --- Difficult to recreate constraints, leave it as is --- ALTER TABLE ct_public_personal_profiles --- DROP CONSTRAINT cms_organiz_organiz_id_p_kk8qt; - +-- Drop contraints with old names ALTER TABLE ct_public_personal_profiles - RENAME TO ct_ppp ; + DROP CONSTRAINT ct_pub_per_prof_pro_id_p__8_1d; + +ALTER TABLE ct_public_personal_profile + DROP CONSTRAINT ct_pub_per_prof_pro_id_f_4akoj ALTER TABLE ct_public_personal_profiles_bundles - RENAME TO ct_ppp_bundles ; + DROP CONSTRAINT ct_pub_per_pro_bun_bun_p_zhc9i; + +ALTER TABLE ct_public_personal_profiles_bundles + DROP CONSTRAINT ct_pub_per_pro_bun_bun_f__jr2_; ALTER TABLE ct_public_personal_profiles_owner_map - RENAME TO ct_ppp_owner_map ; + DROP CONSTRAINT ct_pub_per_pro_own_map_p_rr7ie; + +ALTER TABLE ct_public_personal_profiles_owner_map + DROP CONSTRAINT ct_pub_per_pro_own_map_f_cd7_1; + +ALTER TABLE ct_public_personal_profiles_owner_map + DROP CONSTRAINT ct_pub_per_pro_own_map_f_ugs15; ALTER TABLE ct_public_personal_profiles_nav_items - RENAME TO ct_ppp_nav_items ; + DROP CONSTRAINT ct_pub_per_pro_nav_ite_p_ijb6c; +ALTER TABLE ct_public_personal_profiles_nav_items + DROP CONSTRAINT ct_pub_per_pro_nav_ite_u_cqkdo; +-- Rename tables +ALTER TABLE ct_public_personal_profiles + RENAME TO ct_ppp ; + +ALTER TABLE ct_public_personal_profiles_bundles + RENAME TO ct_ppp_bundles ; + +ALTER TABLE ct_public_personal_profiles_owner_map + RENAME TO ct_ppp_owner_map ; + +ALTER TABLE ct_public_personal_profiles_nav_items + RENAME TO ct_ppp_nav_items ; + +-- Recreate contstraints with new names (copied from generated DDL files) +ALTER TABLE ct_ppp + ADD CONSTRAINT ct_ppp_profile_id_p_ejt_j PRIMARY KEY (profile_id); + +ALTER TABLE ct_ppp + ADD CONSTRAINT ct_ppp_profile_id_f_7znuj + FOREIGN KEY (profile_id)REFERENCES cms_pages(item_id); + +ALTER TABLE ct_ppp_bundles + ADD CONSTRAINT ct_ppp_bundle_bundl_id_p_eeszn PRIMARY KEY(bundle_id); + +ALTER TABLE ct_ppp_bundles + ADD CONSTRAINT ct_ppp_bundle_bundl_id_f_1u4im + FOREIGN KEY (bundle_id) REFERENCES cms_bundles(bundle_id); + +ALTER TABLE ct_ppp_onwer_map + ADD CONSTRAINT ct_ppp_own_map_own_id__p_rqs7q + PRIMARY KEY(owner_id, profile_id); + +ALTER TABLE ct_ppp_owner_map + ADD CONSTRAINT ct_ppp_own_map_owne_id_f_ouqqr + FOREIGN KEY (owner_id) REFERENCES cms_person_bundles(bundle_id); + +ALTER TABLE ct_ppp_owner_map + ADD CONSTRAINT ct_ppp_own_map_prof_id_f_tnfpj + FOREIGN KEY (profile_id) REFERENCES ct_ppp_bundles(bundle_id); + +ALTER TABLE ct_ppp_nav_items + ADD CONSTRAINT ct_ppp_nav_ite_obje_id_p_r7ipd PRIMARY KEY(object_id) + +ALTER TABLE ct_ppp_nav_items + ADD CONSTRAINT CONSTRAINT ct_ppp_nav_ite_key_lab_u_ecekv UNIQUE("key", lang, label) \ No newline at end of file diff --git a/ccm-cms-publicpersonalprofile/sql/ccm-cms-publicpersonalprofile/upgrade/postgres-6.6.5-6.6.6.sql b/ccm-cms-publicpersonalprofile/sql/ccm-cms-publicpersonalprofile/upgrade/postgres-6.6.5-6.6.6.sql index c039d1c6b..011b216ea 100644 --- a/ccm-cms-publicpersonalprofile/sql/ccm-cms-publicpersonalprofile/upgrade/postgres-6.6.5-6.6.6.sql +++ b/ccm-cms-publicpersonalprofile/sql/ccm-cms-publicpersonalprofile/upgrade/postgres-6.6.5-6.6.6.sql @@ -28,7 +28,7 @@ -- Don't use for the APLAWS tree. APLAWS is updated from 1.0.4 -- directly to 2.3.x (6.6.12)! -\echo LibreCCM PublicPersonalProfile 6.6.4 -> 6.6.5 Upgrade Script (PostgreSQL) +\echo LibreCCM PublicPersonalProfile 6.6.5 -> 6.6.6 Upgrade Script (PostgreSQL) begin; diff --git a/ccm-cms-types-decisiontree/sql/ccm-cms-types-decisiontree/upgrade/postgres-6.6.0-6.6.1.sql b/ccm-cms-types-decisiontree/sql/ccm-cms-types-decisiontree/upgrade/postgres-6.6.0-6.6.1.sql index 3e4536df0..754b429b3 100644 --- a/ccm-cms-types-decisiontree/sql/ccm-cms-types-decisiontree/upgrade/postgres-6.6.0-6.6.1.sql +++ b/ccm-cms-types-decisiontree/sql/ccm-cms-types-decisiontree/upgrade/postgres-6.6.0-6.6.1.sql @@ -25,11 +25,9 @@ -- --> ct_decisiontree_section_opts.option_id -- * ct_decisiontree_section_options.option_id -- --> ct_decisiontree_section_opts.option_id --- Actually no update script is provided because no installation should use --- this content type yet, all changes are prerelease. --- begin; +begin; --- \i postgres/6.6.0-6.6.1/upd_decisiontree_tables.sql +\i postgres/6.6.0-6.6.1/upd_decisiontree_tables.sql --- commit; +commit; diff --git a/ccm-cms-types-decisiontree/sql/ccm-cms-types-decisiontree/upgrade/postgres/6.6.0-6.6.1/upd_decisiontree_tables.sql b/ccm-cms-types-decisiontree/sql/ccm-cms-types-decisiontree/upgrade/postgres/6.6.0-6.6.1/upd_decisiontree_tables.sql new file mode 100644 index 000000000..f537d4b9c --- /dev/null +++ b/ccm-cms-types-decisiontree/sql/ccm-cms-types-decisiontree/upgrade/postgres/6.6.0-6.6.1/upd_decisiontree_tables.sql @@ -0,0 +1,40 @@ +-- +-- Copyright (C) 2014 Jens Pelzetter. All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- + +ALTER TABLE ONLY ct_decisiontree_section_options + DROP CONSTRAINT ct_deci_sec_opt_opt_id_p_0p52e; + +ALTER TABLE ONLY ct_decisiontree_section_options + DROP CONSTRAINT ct_deci_sec_opt_opt_id_f_ysyhm; + +ALTER TABLE ONLY ct_decisiontree_section_options + DROP CONSTRAINT ct_deci_sec_opt_sec_id_f_129bc; + +ALTER TABLE ONLY ct_decisiontree_section_options + RENAME TO ct_decisiontree_section_opts; + +ALTER TABLE ct_decisiontree_section_opts + ADD CONSTRAINT ct_deci_sec_opt_opt_id_p_5od37 PRIMARY KEY (option_id) + +ALTER TABLE ct_decisiontree_section_opts + ADD CONSTRAINT ct_deci_sec_opt_opt_id_f_hb7ct + FOREIGN KEY (option_id) REFERENCES cms_items(item_id); + +ALTER TABLE ct_decisiontree_section_opts + ADD CONSTRAINT ct_deci_sec_opt_sec_id_f_fczee + FOREIGN KEY (section_id) REFERENCES ct_decisiontree_sections(section_id); diff --git a/ccm-cms-types-decisiontree/src/ccm-cms-types-decisiontree.upgrade b/ccm-cms-types-decisiontree/src/ccm-cms-types-decisiontree.upgrade index 0bea21e0b..88cef883a 100644 --- a/ccm-cms-types-decisiontree/src/ccm-cms-types-decisiontree.upgrade +++ b/ccm-cms-types-decisiontree/src/ccm-cms-types-decisiontree.upgrade @@ -1,7 +1,14 @@ - -