[open-ils-commits] r17728 - branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Sep 16 10:31:19 EDT 2010


Author: miker
Date: 2010-09-16 10:31:17 -0400 (Thu, 16 Sep 2010)
New Revision: 17728

Modified:
   branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0385.schema.perm_list_fkeys.sql
Log:
This needs to be the same in 2.0 as trunk, and the changes to this script need to make it into the 1.6-2.0 upgrade script as well, if not there already

Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0385.schema.perm_list_fkeys.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0385.schema.perm_list_fkeys.sql	2010-09-16 14:28:09 UTC (rev 17727)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0385.schema.perm_list_fkeys.sql	2010-09-16 14:31:17 UTC (rev 17728)
@@ -1,3 +1,16 @@
+
+-- First drop the stuff we are going to (re)create.  If it fails for not existing, fine.
+-- Some constraints might have different names, so we try all of them.
+ALTER TABLE permission.grp_perm_map        DROP CONSTRAINT grp_perm_map_perm_fkey;
+ALTER TABLE permission.usr_perm_map        DROP CONSTRAINT usr_perm_map_perm_fkey;
+ALTER TABLE permission.usr_object_perm_map DROP CONSTRAINT usr_object_perm_map_perm_fkey;
+
+ALTER TABLE config.org_unit_setting_type   DROP CONSTRAINT view_perm_fkey;
+ALTER TABLE config.org_unit_setting_type   DROP CONSTRAINT update_perm_fkey;
+ALTER TABLE config.org_unit_setting_type   DROP CONSTRAINT org_unit_setting_type_view_perm_fkey;    -- alternate name
+ALTER TABLE config.org_unit_setting_type   DROP CONSTRAINT org_unit_setting_type_update_perm_fkey;  -- alternate name
+
+
 BEGIN;
 
 INSERT INTO config.upgrade_log (version) VALUES ('0385'); --gmc
@@ -2,15 +15,10 @@
 
-ALTER TABLE permission.grp_perm_map DROP CONSTRAINT grp_perm_map_perm_fkey;
 ALTER TABLE permission.grp_perm_map ADD CONSTRAINT grp_perm_map_perm_fkey FOREIGN KEY (perm)
     REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE permission.usr_perm_map DROP CONSTRAINT usr_perm_map_perm_fkey;
 ALTER TABLE permission.usr_perm_map ADD CONSTRAINT usr_perm_map_perm_fkey FOREIGN KEY (perm)
     REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE permission.usr_object_perm_map DROP CONSTRAINT usr_object_perm_map_perm_fkey;
 ALTER TABLE permission.usr_object_perm_map ADD CONSTRAINT usr_object_perm_map_perm_fkey FOREIGN KEY (perm)
     REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-ALTER TABLE config.org_unit_setting_type DROP CONSTRAINT view_perm_fkey;
-ALTER TABLE config.org_unit_setting_type ADD CONSTRAINT view_perm_fkey FOREIGN KEY (view_perm) REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE config.org_unit_setting_type DROP CONSTRAINT update_perm_fkey;
+ALTER TABLE config.org_unit_setting_type ADD CONSTRAINT view_perm_fkey   FOREIGN KEY (view_perm  ) REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
 ALTER TABLE config.org_unit_setting_type ADD CONSTRAINT update_perm_fkey FOREIGN KEY (update_perm) REFERENCES permission.perm_list (id) ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED;



More information about the open-ils-commits mailing list