LP#1480432: stamp DB update
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 8 Aug 2017 21:28:43 +0000 (17:28 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 8 Aug 2017 21:28:43 +0000 (17:28 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/1050.function.permission.user_perms.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.function.permission.user_perms.sql [deleted file]

index 6cc41db..9dc75df 100644 (file)
@@ -90,7 +90,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1049', :eg_version); -- mmorgan/stompro/gmcharlt
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1050', :eg_version); -- mmorgan/cesardv/gmcharlt
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/1050.function.permission.user_perms.sql b/Open-ILS/src/sql/Pg/upgrade/1050.function.permission.user_perms.sql
new file mode 100644 (file)
index 0000000..5a9b0d5
--- /dev/null
@@ -0,0 +1,27 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1050', :eg_version); -- mmorgan/cesardv/gmcharlt
+
+CREATE OR REPLACE FUNCTION permission.usr_perms ( INT ) RETURNS SETOF permission.usr_perm_map AS $$
+    SELECT     DISTINCT ON (usr,perm) *
+         FROM  (
+                       (SELECT * FROM permission.usr_perm_map WHERE usr = $1)
+            UNION ALL
+                       (SELECT -p.id, $1 AS usr, p.perm, p.depth, p.grantable
+                         FROM  permission.grp_perm_map p
+                         WHERE p.grp IN (
+      SELECT   (permission.grp_ancestors(
+      (SELECT profile FROM actor.usr WHERE id = $1)
+                                       )).id
+                               )
+                       )
+            UNION ALL
+                       (SELECT -p.id, $1 AS usr, p.perm, p.depth, p.grantable
+                         FROM  permission.grp_perm_map p
+                         WHERE p.grp IN (SELECT (permission.grp_ancestors(m.grp)).id FROM permission.usr_grp_map m WHERE usr = $1))
+               ) AS x
+         ORDER BY 2, 3, 4 ASC, 5 DESC ;
+$$ LANGUAGE SQL STABLE ROWS 10;
+
+COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.permission.user_perms.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.permission.user_perms.sql
deleted file mode 100644 (file)
index 10af7ba..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-BEGIN;
-
-SELECT evergreen.upgrade_deps_block_check('0991', :eg_version);
-
-CREATE OR REPLACE FUNCTION permission.usr_perms ( INT ) RETURNS SETOF permission.usr_perm_map AS $$
-    SELECT     DISTINCT ON (usr,perm) *
-         FROM  (
-                       (SELECT * FROM permission.usr_perm_map WHERE usr = $1)
-            UNION ALL
-                       (SELECT -p.id, $1 AS usr, p.perm, p.depth, p.grantable
-                         FROM  permission.grp_perm_map p
-                         WHERE p.grp IN (
-      SELECT   (permission.grp_ancestors(
-      (SELECT profile FROM actor.usr WHERE id = $1)
-                                       )).id
-                               )
-                       )
-            UNION ALL
-                       (SELECT -p.id, $1 AS usr, p.perm, p.depth, p.grantable
-                         FROM  permission.grp_perm_map p
-                         WHERE p.grp IN (SELECT (permission.grp_ancestors(m.grp)).id FROM permission.usr_grp_map m WHERE usr = $1))
-               ) AS x
-         ORDER BY 2, 3, 4 ASC, 5 DESC ;
-$$ LANGUAGE SQL STABLE ROWS 10;
-
-COMMIT;
-