From: Jane Sandberg Date: Wed, 19 Apr 2023 02:31:13 +0000 (-0700) Subject: LP1929593 stamp upgrade script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=90e64b9be1e2e06d957798b814ca09e27233203b;p=Evergreen.git LP1929593 stamp upgrade script Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 19adddd40f..92d28a9153 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -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 ('1363', :eg_version); -- dbriem / smorrison / gmcharlt +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1364', :eg_version); -- phasefx / rfrasur / sandbergja CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/1364.data.edit_barcode_perm.sql b/Open-ILS/src/sql/Pg/upgrade/1364.data.edit_barcode_perm.sql new file mode 100644 index 0000000000..db00ed473f --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/1364.data.edit_barcode_perm.sql @@ -0,0 +1,35 @@ +BEGIN; + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('1364', :eg_version); + +-- 950.data.seed-values.sql + +INSERT INTO permission.perm_list ( id, code, description ) VALUES + ( 642, 'UPDATE_COPY_BARCODE', oils_i18n_gettext(642, + 'Update the barcode for an item.', 'ppl', 'description')) +; + +-- give this perm to perm groups that already have UPDATE_COPY +WITH perms_to_add AS + (SELECT id FROM + permission.perm_list + WHERE code IN ('UPDATE_COPY_BARCODE')) +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) + + --- we're going to match the depth of their existing perm + AND perm = ( + SELECT id + FROM permission.perm_list + WHERE code = 'UPDATE_COPY' + ); + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.edit_barcode_perm.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.edit_barcode_perm.sql deleted file mode 100644 index 3d747f20d6..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.edit_barcode_perm.sql +++ /dev/null @@ -1,35 +0,0 @@ -BEGIN; - --- check whether patch can be applied -SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); - --- 950.data.seed-values.sql - -INSERT INTO permission.perm_list ( id, code, description ) VALUES - ( 642, 'UPDATE_COPY_BARCODE', oils_i18n_gettext(642, - 'Update the barcode for an item.', 'ppl', 'description')) -; - --- give this perm to perm groups that already have UPDATE_COPY -WITH perms_to_add AS - (SELECT id FROM - permission.perm_list - WHERE code IN ('UPDATE_COPY_BARCODE')) -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) - - --- we're going to match the depth of their existing perm - AND perm = ( - SELECT id - FROM permission.perm_list - WHERE code = 'UPDATE_COPY' - ); - -COMMIT;