From: Jason Boyer Date: Tue, 29 Sep 2020 14:32:48 +0000 (-0400) Subject: LP1849212: (follow-up) Don't use group ids in upgrade scripts X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=72c71e71f17d216f3894579aee9a152600c369a8;p=working%2FEvergreen.git LP1849212: (follow-up) Don't use group ids in upgrade scripts Previously if there was not a permission group with an id of 9 this upgrade script would fail. Changing the consatruction to match the seed data allows the insert to benignly do nothing if the group is missing. Also, the permission is made grantable. Signed-off-by: Jason Boyer --- diff --git a/Open-ILS/src/sql/Pg/upgrade/1232.schema.course-materials-module.sql b/Open-ILS/src/sql/Pg/upgrade/1232.schema.course-materials-module.sql index 37d909d44e..d96797d8ff 100644 --- a/Open-ILS/src/sql/Pg/upgrade/1232.schema.course-materials-module.sql +++ b/Open-ILS/src/sql/Pg/upgrade/1232.schema.course-materials-module.sql @@ -71,7 +71,18 @@ INSERT INTO permission.perm_list(id, code, description) ) ); -INSERT INTO permission.grp_perm_map(perm, grp, depth) VALUES (624, 9, 0), (624, 11, 0), (624, 12, 0), (624, 13, 0); +INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) + SELECT + pgt.id, perm.id, aout.depth, TRUE + FROM + permission.grp_tree pgt, + permission.perm_list perm, + actor.org_unit_type aout + WHERE + pgt.name = 'Circulation Administrator' AND + aout.name = 'Consortium' AND + perm.code = 'MANAGE_RESERVES' +; INSERT INTO config.org_unit_setting_type (grp, name, datatype, label, description, fm_class) diff --git a/Open-ILS/src/sql/Pg/version-upgrade/3.5.1-3.6-beta1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/3.5.1-3.6-beta1-upgrade-db.sql index 9b6578ac60..7844ead6d5 100644 --- a/Open-ILS/src/sql/Pg/version-upgrade/3.5.1-3.6-beta1-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/version-upgrade/3.5.1-3.6-beta1-upgrade-db.sql @@ -1734,7 +1734,18 @@ INSERT INTO permission.perm_list(id, code, description) ) ); -INSERT INTO permission.grp_perm_map(perm, grp, depth) VALUES (624, 9, 0); +INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) + SELECT + pgt.id, perm.id, aout.depth, TRUE + FROM + permission.grp_tree pgt, + permission.perm_list perm, + actor.org_unit_type aout + WHERE + pgt.name = 'Circulation Administrator' AND + aout.name = 'Consortium' AND + perm.code = 'MANAGE_RESERVES' +; INSERT INTO config.org_unit_setting_type (grp, name, datatype, label, description, fm_class)