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
master
jensp 2014-12-16 09:37:39 +00:00
parent 9c5f68ad11
commit fb3a141343
17 changed files with 229 additions and 130 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -1,7 +1,14 @@
<upgrade>
<version from="1.0.3" to="6.6.0">
<script sql="ccm-cms-types-decisiontree/upgrade/::database::-1.0.3-6.6.0.sql"/>
</version>
<version from="1.0.3" to="6.6.0">
<script sql="ccm-cms-types-decisiontree/upgrade/::database::-1.0.3-6.6.0.sql"/>
</version>
<version from="6.6.0" to="6.6.1">
<!--
Rename table ct_decisiontree_section_options to ct_decisiontree_section_opts
because of 30 characters limit for object names in Oracle
-->
<script sql="ccm-cms-types-decisiontree/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version>
</upgrade>

View File

@ -35,7 +35,10 @@ delete from object_context
);
-- delete from acs_objects all entries referring to node_id in site_nodes
alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
-- no necssary for upgrading a 1.0.4 installation to 2.x.y because site_nodes will be removed
-- completly in the process and the constraint is removed earlier in the process by
-- ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
delete from acs_objects
where object_id in
@ -55,9 +58,10 @@ delete from site_nodes
where object_type
like '%cms.ContentSection%')
);
alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
FOREIGN KEY (node_id)
REFERENCES acs_objects (object_id);
-- No needed anymore, see above and ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
-- FOREIGN KEY (node_id)
-- REFERENCES acs_objects (object_id);

View File

@ -27,119 +27,93 @@
-- * 6.6.3-6.6.4/create_orgaunit_hierarchy_table.sql
-- * 6.6.4-6.6.5/create_orgaunit_bundle.sql
-- * (6.6.7-6.6.8/add_personsstr_column.sql)
--
-- We rename also the constraint where possible. We can't rename the primary key constraint of
-- cms_organizationalunits/cms_orgaunits table
-- (old name: cms_organiz_organiz_id_p_kk8qt, new name: cms_orgauni_orgauni_id_p_ycjef) because
-- some other modules which provide content types which extending GenericOrganizatialUnit are
-- depending on this constraint.
-- ALTER TABLE cms_organizationalunits
-- DROP CONSTRAINT cms_organiz_organiz_id_p_kk8qt;
ALTER TABLE cms_organizationalunits
DROP CONSTRAINT cms_organiz_organiz_id_p_kk8qt;
DROP CONSTRAINT cms_organiz_organiz_id_f_ubliq;
ALTER TABLE cms_organizationalunits_contact_map
DROP CONSTRAINT cms_org_con_map_con_id_p_1rc4y;
DROP CONSTRAINT cms_org_con_map_con_id_p_1rc4y;
ALTER TABLE cms_organizationalunits_person_map
DROP CONSTRAINT cms_org_per_map_org_id_p_km6_m;
DROP CONSTRAINT cms_org_per_map_org_id_p_km6_m;
ALTER TABLE cms_organizationalunits_hierarchy_map
DROP CONSTRAINT cms_org_hie_map_sub_or_p_nykpq;
DROP CONSTRAINT cms_org_hie_map_sub_or_p_nykpq;
ALTER TABLE cms_organizationalunits
RENAME TO cms_orgaunits ;
RENAME TO cms_orgaunits ;
ALTER TABLE cms_orgaunits
RENAME column organizationalunit_id TO orgaunit_id ;
RENAME column organizationalunit_id TO orgaunit_id ;
ALTER TABLE cms_organizationalunits_contact_map
RENAME TO cms_orgaunits_contact_map ;
RENAME TO cms_orgaunits_contact_map ;
ALTER TABLE cms_orgaunits_contact_map
RENAME column organizationalunit_id TO orgaunit_id ;
RENAME column organizationalunit_id TO orgaunit_id ;
ALTER TABLE cms_organizationalunits_person_map
RENAME TO cms_orgaunits_person_map ;
RENAME TO cms_orgaunits_person_map ;
ALTER TABLE cms_orgaunits_person_map
RENAME column organizationalunit_id TO orgaunit_id ;
RENAME column organizationalunit_id TO orgaunit_id ;
ALTER TABLE cms_organizationalunits_hierarchy_map
RENAME TO cms_orgaunits_hierarchy_map ;
-- create table cms_orgaunits (
-- orgaunit_id integer NOT NULL,
-- addendum character varying(512)
-- );
-- create table cms_orgaunits_contact_map (
-- orgaunit_id integer NOT NULL,
-- contact_id integer NOT NULL,
-- contact_type character varying(100),
-- map_order integer
-- );
-- create table cms_orgaunits_person_map (
-- orgaunit_id integer NOT NULL,
-- person_id integer NOT NULL,
-- role_name character varying(100),
-- status character varying(100)
-- );
-- CREATE TABLE cms_orgaunits_hierarchy_map (
-- superior_orgaunit_id integer NOT NULL,
-- subordinate_orgaunit_id integer NOT NULL,
-- assoc_type character varying(128),
-- superior_orgaunit_order integer,
-- subordinate_orgaunit_order integer
-- );
RENAME TO cms_orgaunits_hierarchy_map ;
ALTER TABLE ONLY cms_orgaunits_contact_map
ADD CONSTRAINT cms_org_con_map_con_id_p_1rc4y
-- PRIMARY KEY (contact_id, orgaunit_id)
;
ADD CONSTRAINT cms_org_con_map_con_id_p_pazb1
PRIMARY KEY (contact_id, orgaunit_id);
ALTER TABLE ONLY cms_orgaunits_person_map
ADD CONSTRAINT cms_org_per_map_org_id_p_km6_m
-- PRIMARY KEY (person_id, orgaunit_id)
;
ALTER TABLE ONLY cms_orgaunits
ADD CONSTRAINT cms_organiz_organiz_id_p_kk8qt
-- PRIMARY KEY (orgaunit_id)
;
-- ALTER TABLE ONLY cms_orgaunits
-- ADD CONSTRAINT cms_orgauni_orgauni_id_p_ycjef
-- PRIMARY KEY (orgaunit_id);
ALTER TABLE cms_orgaunits
ADD CONSTRAINT cms_orgauni_orgauni_id_f_qxnsg
FOREIGN KEY (orgaunit_id) REFERENCES cms_pages(item_id);
ALTER TABLE ONLY cms_orgaunits_contact_map
ADD CONSTRAINT cms_org_con_map_con_id_f_9tm3c
FOREIGN KEY (contact_id) REFERENCES cms_contacts(contact_id);
ADD CONSTRAINT cms_org_con_map_con_id_f_i7nai
FOREIGN KEY (contact_id) REFERENCES cms_contact_bundles(bundle_id);
ALTER TABLE ONLY cms_orgaunits_contact_map
ADD CONSTRAINT cms_org_con_map_org_id_f_vdrnx
FOREIGN KEY (orgaunit_id)
REFERENCES cms_orgaunits(orgaunit_id);
ADD CONSTRAINT cms_org_con_map_org_id_f_li14a
FOREIGN KEY (orgaunit_id) REFERENCES cms_orgaunit_bundles(bundle_id);
ALTER TABLE ONLY cms_orgaunits_person_map
ADD CONSTRAINT cms_org_per_map_org_id_f_ducb2
FOREIGN KEY (orgaunit_id)
REFERENCES cms_orgaunits(orgaunit_id);
ADD CONSTRAINT cms_org_per_map_org_id_p_7t2yy
PRIMARY KEY (person_id, orgaunit_id);
ALTER TABLE ONLY cms_orgaunits_person_map
ADD CONSTRAINT cms_org_per_map_per_id_f_hrpzh
FOREIGN KEY (person_id) REFERENCES cms_persons(person_id);
ALTER TABLE cms_orgaunits_person_map
ADD CONSTRAINT cms_org_per_map_org_id_f_5gx18
FOREIGN KEY (orgaunit_id) REFERENCES cms_orgaunit_bundles(bundle_id);
ALTER TABLE cms_orgaunits_person_map
ADD CONSTRAINT cms_org_per_map_per_id_f_q2eog
FOREIGN KEY (person_id) REFERENCES cms_person_bundles(bundle_id);
ALTER TABLE ONLY cms_orgaunits_hierarchy_map
ADD CONSTRAINT cms_org_hie_map_sub_or_p_nykpq
ADD CONSTRAINT cms_org_hie_map_sub_or_p_62tce
PRIMARY KEY (subordinate_orgaunit_id, superior_orgaunit_id);
ALTER TABLE ONLY cms_orgaunits_hierarchy_map
ADD CONSTRAINT cms_org_hie_map_sub_or_f_xq5is
FOREIGN KEY (subordinate_orgaunit_id)
REFERENCES cms_orgaunits(orgaunit_id);
ALTER TABLE cms_orgaunits_hierarchy_map
ADD CONSTRAINT cms_org_hie_map_sub_or_f_r7s1i
FOREIGN KEY (subordinate_orgaunit_id) REFERENCES cms_orgaunit_bundles(bundle_id);
ALTER TABLE ONLY cms_orgaunits_hierarchy_map
ADD CONSTRAINT cms_org_hie_map_sup_or_f_qchkn
FOREIGN KEY (superior_orgaunit_id)
REFERENCES cms_orgaunits(orgaunit_id);
ALTER TABLE cms_orgaunits_hierarchy_map
ADD CONSTRAINT cms_org_hie_map_sup_or_f_8klhh
FOREIGN KEY (superior_orgaunit_id) REFERENCES cms_orgaunit_bundles(bundle_id);
ALTER TABLE ONLY cms_orgaunits
ADD CONSTRAINT cms_organiz_organiz_id_f_ubliq
FOREIGN KEY (orgaunit_id) REFERENCES cms_pages(item_id);
--
-- Check: 6.6.7-6.6.8/create_orgaunit_bundle for additional constraints

View File

@ -25,14 +25,14 @@
-- Don't use for the APLAWS tree! APLAWS is update just from 1.0.4 to 2.3.x
ALTER TABLE content_types
drop constraint content_types_mode_ck ;
DROP CONSTRAINT content_types_mode_ck ;
ALTER TABLE content_types
rename COLUMN mode TO type_mode;
RENAME COLUMN mode TO type_mode;
ALTER TABLE content_types
add constraint content_types_mode_ck CHECK
(("type_mode" = ANY (ARRAY['D'::bpchar, 'H'::bpchar, 'I'::bpchar]))) ;
ADD CONSTRAINT content_types_mode_ck
CHECK ( type_mode in ('D', 'H', 'I') );
-- Should not be necessary, rename shouldn't modify this
-- ALTER TABLE content_types

View File

@ -28,6 +28,6 @@
begin;
\i ../postgres/upgrade/6.6.11-6.6.12/upd_table_content_types.sql
\i ../postgres/upgrade/6.6.11-6.6.12/upd_tables_cms_organisation.sql
\i ../postgres/upgrade/6.6.11-6.6.12/ren_tables_cms_organisation.sql
commit;

View File

@ -84,4 +84,10 @@
similar assocs -->
<script class="com.arsdigita.cms.contenttypes.upgrades.Upgrade6610to6611ContactAddressAssoc"/>
</version>
<version from="6.6.11" to="6.6.12">
<!--
Rename several tables because of the limit of 30 characters for table name in Oracle.
-->
<script sql="ccm-cms/upgrade/::database::-6.6.11-6.6.12.sql"/>
</version>
</upgrade>

View File

@ -35,7 +35,8 @@ delete from object_context
);
-- delete from acs_objects all entries referring to node_id in site_nodes
alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
delete from acs_objects
where object_id in
(select node_id from site_nodes where object_id in
@ -54,7 +55,8 @@ delete from site_nodes
where object_type
like '%admin.Admin%')
);
alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
FOREIGN KEY (node_id)
REFERENCES acs_objects (object_id);

View File

@ -36,7 +36,8 @@ delete from object_context
);
-- delete from acs_objects all entries referring to DS node_id in site_nodes
alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
delete from acs_objects
where object_id in
(select node_id from site_nodes where object_id in
@ -53,7 +54,8 @@ delete from site_nodes
(select package_type_id from apm_package_types
where package_key like 'webdev-support')
);
alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
FOREIGN KEY (node_id)
REFERENCES acs_objects (object_id);

View File

@ -36,7 +36,8 @@ delete from object_context
);
-- delete from acs_objects all entries referring to DS node_id in site_nodes
alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
delete from acs_objects
where object_id in
(select node_id from site_nodes where object_id in
@ -53,9 +54,10 @@ delete from site_nodes
(select package_type_id from apm_package_types
where package_key like 'acs-permissions')
);
alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
FOREIGN KEY (node_id)
REFERENCES acs_objects (object_id);
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
-- FOREIGN KEY (node_id)
-- REFERENCES acs_objects (object_id);

View File

@ -36,7 +36,8 @@ delete from object_context
);
-- delete from acs_objects all entries referring to node_id in site_nodes
alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
delete from acs_objects
where object_id in
(select node_id from site_nodes where object_id in
@ -55,9 +56,10 @@ delete from site_nodes
where object_type
like '%sitemap.SiteMap%')
);
alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
FOREIGN KEY (node_id)
REFERENCES acs_objects (object_id);
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
-- FOREIGN KEY (node_id)
-- REFERENCES acs_objects (object_id);

View File

@ -35,7 +35,8 @@ delete from object_context
);
-- delete from acs_objects all entries referring to node_id in site_nodes
alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
delete from acs_objects
where object_id in
(select node_id from site_nodes where object_id in
@ -54,9 +55,10 @@ delete from site_nodes
where object_type
like 'com.arsdigita.london.navigation.Navigation')
);
alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
FOREIGN KEY (node_id)
REFERENCES acs_objects (object_id);
-- Not needed anymore, see ccm-themedirector-6.6.1-6.6.2
-- alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
-- FOREIGN KEY (node_id)
-- REFERENCES acs_objects (object_id);

View File

@ -81,14 +81,18 @@ delete from acs_objects
where object_type like '%com.arsdigita.kernel%'
AND display_name like '%hemes%' ;
alter table site_nodes add
constraint site_nodes_parent_id_f_sacav foreign key (parent_id)
references site_nodes(node_id);
-- Do not recreate the constraint for site_nodes. During the upgrade from 1.0.4 to 2.x.y site_nodes
-- will be removed completly, therefore we don't need the constraints. ccm-themedirector-6.6.1-6.6.2
-- is the first upgrade in the process which deals with the site_nodes, therefore it removes the
-- constraints.
-- alter table site_nodes add
-- constraint site_nodes_parent_id_f_sacav foreign key (parent_id)
-- references site_nodes(node_id);
alter table site_nodes add
constraint site_nodes_node_id_f_n1m2y foreign key (node_id)
references acs_objects(object_id);
-- alter table site_nodes add
-- constraint site_nodes_node_id_f_n1m2y foreign key (node_id)
-- references acs_objects(object_id);
alter table site_nodes add
constraint site_nodes_object_id_f_ked74 foreign key (object_id)
references apm_packages(package_id);
-- alter table site_nodes add
-- constraint site_nodes_object_id_f_ked74 foreign key (object_id)
-- references apm_packages(package_id);