]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/ZZZA.data.move_legacy_copy_alerts.sql
LP#1676608: provide DB update script to convert legacy copy alert messages
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / ZZZA.data.move_legacy_copy_alerts.sql
1 BEGIN;
2
3 --- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
4
5 \qecho Copying copy alert messages to normal checkout copy alerts...
6 INSERT INTO asset.copy_alert (alert_type, copy, note, create_staff)
7 SELECT 1, id, alert_message, 1
8 FROM asset.copy
9 WHERE alert_message IS NOT NULL
10 AND   alert_message <> '';
11
12 \qecho Copying copy alert messages to normal checkin copy alerts...
13 INSERT INTO asset.copy_alert (alert_type, copy, note, create_staff)
14 SELECT 2, id, alert_message, 1
15 FROM asset.copy
16 WHERE alert_message IS NOT NULL
17 AND   alert_message <> '';
18
19 \qecho Clearing legacy copy alert field; this may take a while
20 UPDATE asset.copy SET alert_message = NULL
21 WHERE alert_message IS NOT NULL;
22
23 COMMIT;