LP#1977761: stamp DB update
authorGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 01:41:27 +0000 (21:41 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 01:41:27 +0000 (21:41 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/1351.data.acqrolloverperm.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.data.acqrolloverperm.sql [deleted file]

index 8b10591..823204f 100644 (file)
@@ -92,7 +92,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 ('1350', :eg_version); -- rhamby/gcollum/gmcharlt
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1351', :eg_version); -- tlittle/lstratton/gmcharlt
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/1351.data.acqrolloverperm.sql b/Open-ILS/src/sql/Pg/upgrade/1351.data.acqrolloverperm.sql
new file mode 100644 (file)
index 0000000..ffe4843
--- /dev/null
@@ -0,0 +1,41 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1351', :eg_version);
+
+INSERT INTO permission.perm_list ( id, code, description )
+    VALUES (
+        641,
+        'ADMIN_FUND_ROLLOVER',
+        oils_i18n_gettext(
+            641,
+            'Allow a user to perform fund propagation and rollover',
+            'ppl',
+            'description'
+        )
+    );
+
+-- ensure that permission groups that are able to
+-- rollover funds can continue to do so
+WITH perms_to_add AS
+    (SELECT id FROM
+    permission.perm_list
+    WHERE code IN ('ADMIN_FUND_ROLLOVER'))
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+    SELECT grp, perms_to_add.id as perm, depth, grantable
+        FROM perms_to_add,
+        permission.grp_perm_map
+        
+        --- Don't add the permissions if they have already been assigned
+        WHERE grp NOT IN
+            (SELECT DISTINCT grp FROM permission.grp_perm_map
+            INNER JOIN perms_to_add ON perm=perms_to_add.id)
+            
+        --- Anybody who can view resources should also see reservations
+        --- at the same level
+        AND perm = (
+            SELECT id
+                FROM permission.perm_list
+                WHERE code = 'ADMIN_FUND'
+        );
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.acqrolloverperm.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.acqrolloverperm.sql
deleted file mode 100644 (file)
index b205641..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-BEGIN;
-
-INSERT INTO permission.perm_list ( id, code, description )
-    VALUES (
-        641,
-        'ADMIN_FUND_ROLLOVER',
-        oils_i18n_gettext(
-            641,
-            'Allow a user to perform fund propagation and rollover',
-            'ppl',
-            'description'
-        )
-    );
-
--- ensure that permission groups that are able to
--- rollover funds can continue to do so
-WITH perms_to_add AS
-    (SELECT id FROM
-    permission.perm_list
-    WHERE code IN ('ADMIN_FUND_ROLLOVER'))
-INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
-    SELECT grp, perms_to_add.id as perm, depth, grantable
-        FROM perms_to_add,
-        permission.grp_perm_map
-        
-        --- Don't add the permissions if they have already been assigned
-        WHERE grp NOT IN
-            (SELECT DISTINCT grp FROM permission.grp_perm_map
-            INNER JOIN perms_to_add ON perm=perms_to_add.id)
-            
-        --- Anybody who can view resources should also see reservations
-        --- at the same level
-        AND perm = (
-            SELECT id
-                FROM permission.perm_list
-                WHERE code = 'ADMIN_FUND'
-        );
-
-COMMIT;