Upgrades for PostgreSQL databases because of the renaming of several tables to conform with Oracles 30 character limit for table names.

git-svn-id: https://svn.libreccm.org/ccm/trunk@3060 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-12-16 16:09:07 +00:00
parent c9bbe9a66d
commit f78d59e33b
3 changed files with 30 additions and 27 deletions

View File

@ -30,62 +30,64 @@
-- Drop contraints with old names -- Drop contraints with old names
-- Can't delete primary key constraint because of depencies.
-- ALTER TABLE ct_public_personal_profiles
-- DROP CONSTRAINT ct_pub_per_prof_pro_id_p__8_1d;
ALTER TABLE ct_public_personal_profiles ALTER TABLE ct_public_personal_profiles
DROP CONSTRAINT ct_pub_per_prof_pro_id_p__8_1d; DROP CONSTRAINT ct_pub_per_prof_pro_id_f_4akoj;
ALTER TABLE ct_public_personal_profile --ALTER TABLE ct_public_personal_profile_bundles
DROP CONSTRAINT ct_pub_per_prof_pro_id_f_4akoj -- DROP CONSTRAINT ct_pub_per_pro_bun_bun_p_zhc9i;
ALTER TABLE ct_public_personal_profiles_bundles ALTER TABLE ct_public_personal_profile_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_; DROP CONSTRAINT ct_pub_per_pro_bun_bun_f__jr2_;
ALTER TABLE ct_public_personal_profiles_owner_map ALTER TABLE ct_public_personal_profile_owner_map
DROP CONSTRAINT ct_pub_per_pro_own_map_p_rr7ie; DROP CONSTRAINT ct_pub_per_pro_own_map_p_rr7ie;
ALTER TABLE ct_public_personal_profiles_owner_map ALTER TABLE ct_public_personal_profile_owner_map
DROP CONSTRAINT ct_pub_per_pro_own_map_f_cd7_1; DROP CONSTRAINT ct_pub_per_pro_own_map_f_cd7_1;
ALTER TABLE ct_public_personal_profiles_owner_map ALTER TABLE ct_public_personal_profile_owner_map
DROP CONSTRAINT ct_pub_per_pro_own_map_f_ugs15; DROP CONSTRAINT ct_pub_per_pro_own_map_f_ugs15;
ALTER TABLE ct_public_personal_profiles_nav_items ALTER TABLE ct_public_personal_profile_nav_items
DROP CONSTRAINT ct_pub_per_pro_nav_ite_p_ijb6c; DROP CONSTRAINT ct_pub_per_pro_nav_ite_p_ijb6c;
ALTER TABLE ct_public_personal_profiles_nav_items ALTER TABLE ct_public_personal_profile_nav_items
DROP CONSTRAINT ct_pub_per_pro_nav_ite_u_cqkdo; DROP CONSTRAINT ct_pub_per_pro_nav_ite_u_cqkdo;
-- Rename tables -- Rename tables
ALTER TABLE ct_public_personal_profiles ALTER TABLE ct_public_personal_profiles
RENAME TO ct_ppp ; RENAME TO ct_ppp ;
ALTER TABLE ct_public_personal_profiles_bundles ALTER TABLE ct_public_personal_profile_bundles
RENAME TO ct_ppp_bundles ; RENAME TO ct_ppp_bundles ;
ALTER TABLE ct_public_personal_profiles_owner_map ALTER TABLE ct_public_personal_profile_owner_map
RENAME TO ct_ppp_owner_map ; RENAME TO ct_ppp_owner_map ;
ALTER TABLE ct_public_personal_profiles_nav_items ALTER TABLE ct_public_personal_profile_nav_items
RENAME TO ct_ppp_nav_items ; RENAME TO ct_ppp_nav_items ;
-- Recreate contstraints with new names (copied from generated DDL files) -- Recreate contstraints with new names (copied from generated DDL files)
ALTER TABLE ct_ppp -- ALTER TABLE ct_ppp
ADD CONSTRAINT ct_ppp_profile_id_p_ejt_j PRIMARY KEY (profile_id); -- ADD CONSTRAINT ct_ppp_profile_id_p_ejt_j PRIMARY KEY (profile_id);
ALTER TABLE ct_ppp ALTER TABLE ct_ppp
ADD CONSTRAINT ct_ppp_profile_id_f_7znuj ADD CONSTRAINT ct_ppp_profile_id_f_7znuj
FOREIGN KEY (profile_id)REFERENCES cms_pages(item_id); FOREIGN KEY (profile_id)REFERENCES cms_pages(item_id);
ALTER TABLE ct_ppp_bundles -- ALTER TABLE ct_ppp_bundles
ADD CONSTRAINT ct_ppp_bundle_bundl_id_p_eeszn PRIMARY KEY(bundle_id); -- ADD CONSTRAINT ct_ppp_bundle_bundl_id_p_eeszn PRIMARY KEY(bundle_id);
ALTER TABLE ct_ppp_bundles ALTER TABLE ct_ppp_bundles
ADD CONSTRAINT ct_ppp_bundle_bundl_id_f_1u4im ADD CONSTRAINT ct_ppp_bundle_bundl_id_f_1u4im
FOREIGN KEY (bundle_id) REFERENCES cms_bundles(bundle_id); FOREIGN KEY (bundle_id) REFERENCES cms_bundles(bundle_id);
ALTER TABLE ct_ppp_onwer_map ALTER TABLE ct_ppp_owner_map
ADD CONSTRAINT ct_ppp_own_map_own_id__p_rqs7q ADD CONSTRAINT ct_ppp_own_map_own_id__p_rqs7q
PRIMARY KEY(owner_id, profile_id); PRIMARY KEY(owner_id, profile_id);
@ -98,7 +100,7 @@ ALTER TABLE ct_ppp_owner_map
FOREIGN KEY (profile_id) REFERENCES ct_ppp_bundles(bundle_id); FOREIGN KEY (profile_id) REFERENCES ct_ppp_bundles(bundle_id);
ALTER TABLE ct_ppp_nav_items ALTER TABLE ct_ppp_nav_items
ADD CONSTRAINT ct_ppp_nav_ite_obje_id_p_r7ipd PRIMARY KEY(object_id) ADD CONSTRAINT ct_ppp_nav_ite_obje_id_p_r7ipd PRIMARY KEY(object_id);
ALTER TABLE ct_ppp_nav_items ALTER TABLE ct_ppp_nav_items
ADD CONSTRAINT CONSTRAINT ct_ppp_nav_ite_key_lab_u_ecekv UNIQUE("key", lang, label) ADD CONSTRAINT ct_ppp_nav_ite_key_lab_u_ecekv UNIQUE("key", lang, label);

View File

@ -32,6 +32,6 @@
begin; begin;
\i ../postgres/upgrade/6.6.5-6.6.6/fix_app_name.sql \i ../postgres/upgrade/6.6.5-6.6.6/ren_tables_cms_publicpersonalprofile.sql
commit; commit;

View File

@ -16,8 +16,9 @@
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- --
ALTER TABLE ONLY ct_decisiontree_section_options -- Can't delete primary key constraint because of dependcies.
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_p_0p52e;
ALTER TABLE ONLY ct_decisiontree_section_options ALTER TABLE ONLY ct_decisiontree_section_options
DROP CONSTRAINT ct_deci_sec_opt_opt_id_f_ysyhm; DROP CONSTRAINT ct_deci_sec_opt_opt_id_f_ysyhm;
@ -28,8 +29,8 @@ ALTER TABLE ONLY ct_decisiontree_section_options
ALTER TABLE ONLY ct_decisiontree_section_options ALTER TABLE ONLY ct_decisiontree_section_options
RENAME TO ct_decisiontree_section_opts; RENAME TO ct_decisiontree_section_opts;
ALTER TABLE ct_decisiontree_section_opts -- ALTER TABLE ct_decisiontree_section_opts
ADD CONSTRAINT ct_deci_sec_opt_opt_id_p_5od37 PRIMARY KEY (option_id) -- ADD CONSTRAINT ct_deci_sec_opt_opt_id_p_5od37 PRIMARY KEY (option_id)
ALTER TABLE ct_decisiontree_section_opts ALTER TABLE ct_decisiontree_section_opts
ADD CONSTRAINT ct_deci_sec_opt_opt_id_f_hb7ct ADD CONSTRAINT ct_deci_sec_opt_opt_id_f_hb7ct