From: Mike Rylander Date: Thu, 24 Mar 2022 18:34:57 +0000 (-0400) Subject: Stamping upgrade script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=853485a16b6b2ade8923c4d403292b942c231420;p=Evergreen.git Stamping upgrade script Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 7f52d01b1c..ac7bdc6aa4 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 ('1313', :eg_version); -- alynn26/berick +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1319', :eg_version); -- berick/miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/1319.data.angular-copy-templates.sql b/Open-ILS/src/sql/Pg/upgrade/1319.data.angular-copy-templates.sql new file mode 100644 index 0000000000..8fe7d45411 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/1319.data.angular-copy-templates.sql @@ -0,0 +1,33 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('1319', :eg_version); + +DO $SQL$ +BEGIN + + PERFORM TRUE FROM config.usr_setting_type WHERE name = 'cat.copy.templates'; + + IF NOT FOUND THEN -- no matching user setting + + PERFORM TRUE FROM config.workstation_setting_type WHERE name = 'cat.copy.templates'; + + IF NOT FOUND THEN + -- no matching workstation setting + -- Migrate the existing user setting and its data to the new name. + + UPDATE config.usr_setting_type + SET name = 'cat.copy.templates' + WHERE name = 'webstaff.cat.copy.templates'; + + UPDATE actor.usr_setting + SET name = 'cat.copy.templates' + WHERE name = 'webstaff.cat.copy.templates'; + + END IF; + END IF; + +END; +$SQL$; + +COMMIT; + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-copy-templates.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-copy-templates.sql deleted file mode 100644 index 9de4034b56..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-copy-templates.sql +++ /dev/null @@ -1,33 +0,0 @@ -BEGIN; - --- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version); - -DO $SQL$ -BEGIN - - PERFORM TRUE FROM config.usr_setting_type WHERE name = 'cat.copy.templates'; - - IF NOT FOUND THEN -- no matching user setting - - PERFORM TRUE FROM config.workstation_setting_type WHERE name = 'cat.copy.templates'; - - IF NOT FOUND THEN - -- no matching workstation setting - -- Migrate the existing user setting and its data to the new name. - - UPDATE config.usr_setting_type - SET name = 'cat.copy.templates' - WHERE name = 'webstaff.cat.copy.templates'; - - UPDATE actor.usr_setting - SET name = 'cat.copy.templates' - WHERE name = 'webstaff.cat.copy.templates'; - - END IF; - END IF; - -END; -$SQL$; - -COMMIT; -