SQL: include DB changes for LP1951162
authorChris Sharp <csharp@georgialibraries.org>
Mon, 10 Jan 2022 15:07:47 +0000 (10:07 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 10 Jan 2022 15:07:47 +0000 (10:07 -0500)
Open-ILS/src/sql/Pg/version-upgrade/pines_additional_sql_upgrade.sql

index 70d58c4..8f9461a 100644 (file)
@@ -44,4 +44,32 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES
  ( 1101, 'ADMIN_STUDENT_CARDS', oils_i18n_gettext(1101,
     'Modify student card settings', 'ppl', 'description'));
 
+
+-- apply holdings template updates
+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;