[open-ils-commits] r17474 - in trunk/Open-ILS/src/sql/Pg: . upgrade (gmc)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Sep 3 12:37:18 EDT 2010
Author: gmc
Date: 2010-09-03 12:37:15 -0400 (Fri, 03 Sep 2010)
New Revision: 17474
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0385.schema.perm_list_fkeys.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/006.schema.permissions.sql
trunk/Open-ILS/src/sql/Pg/800.fkeys.sql
Log:
allow updates of permission.perm_list.id to cascade
Doing this to make it possible to reshuffle permission IDs
for upgrades to 2.0.x
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-09-03 16:32:19 UTC (rev 17473)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-09-03 16:37:15 UTC (rev 17474)
@@ -68,7 +68,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0384'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0385'); -- gmc
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/006.schema.permissions.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/006.schema.permissions.sql 2010-09-03 16:32:19 UTC (rev 17473)
+++ trunk/Open-ILS/src/sql/Pg/006.schema.permissions.sql 2010-09-03 16:37:15 UTC (rev 17474)
@@ -51,7 +51,7 @@
CREATE TABLE permission.grp_perm_map (
id SERIAL PRIMARY KEY,
grp INT NOT NULL REFERENCES permission.grp_tree (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
- perm INT NOT NULL REFERENCES permission.perm_list (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ perm INT NOT NULL REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
depth INT NOT NULL,
grantable BOOL NOT NULL DEFAULT FALSE,
CONSTRAINT perm_grp_once UNIQUE (grp,perm)
@@ -60,7 +60,7 @@
CREATE TABLE permission.usr_perm_map (
id SERIAL PRIMARY KEY,
usr INT NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
- perm INT NOT NULL REFERENCES permission.perm_list (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ perm INT NOT NULL REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
depth INT NOT NULL,
grantable BOOL NOT NULL DEFAULT FALSE,
CONSTRAINT perm_usr_once UNIQUE (usr,perm)
@@ -69,7 +69,7 @@
CREATE TABLE permission.usr_object_perm_map (
id SERIAL PRIMARY KEY,
usr INT NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
- perm INT NOT NULL REFERENCES permission.perm_list (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ perm INT NOT NULL REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
object_type TEXT NOT NULL,
object_id TEXT NOT NULL,
grantable BOOL NOT NULL DEFAULT FALSE,
Modified: trunk/Open-ILS/src/sql/Pg/800.fkeys.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/800.fkeys.sql 2010-09-03 16:32:19 UTC (rev 17473)
+++ trunk/Open-ILS/src/sql/Pg/800.fkeys.sql 2010-09-03 16:37:15 UTC (rev 17474)
@@ -114,7 +114,7 @@
ALTER TABLE config.remote_account ADD CONSTRAINT config_remote_account_owner_fkey FOREIGN KEY (owner) REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE config.org_unit_setting_type ADD CONSTRAINT view_perm_fkey FOREIGN KEY (view_perm) REFERENCES permission.perm_list (id) 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) DEFERRABLE INITIALLY DEFERRED;
+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;
COMMIT;
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0385.schema.perm_list_fkeys.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0385.schema.perm_list_fkeys.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0385.schema.perm_list_fkeys.sql 2010-09-03 16:37:15 UTC (rev 17474)
@@ -0,0 +1,20 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0385'); --gmc
+
+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 update_perm_fkey FOREIGN KEY (update_perm) REFERENCES permission.perm_list (id) ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;
More information about the open-ils-commits
mailing list