]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0813.data.state-field-settings-fix.sql
LP1889113 Staff catalog record holds sticky org select
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0813.data.state-field-settings-fix.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('0813', :eg_version);
4
5 -- Don't require state in the auditor tracking for user addresses
6
7 ALTER TABLE auditor.actor_usr_address_history ALTER COLUMN state DROP NOT NULL;
8
9 -- Change constraint on actor.org_unit_setting_log to be deferrable initially
10
11 ALTER TABLE config.org_unit_setting_type_log
12   DROP CONSTRAINT org_unit_setting_type_log_field_name_fkey,
13   ADD CONSTRAINT org_unit_setting_type_log_field_name_fkey FOREIGN KEY (field_name)
14     REFERENCES config.org_unit_setting_type (name) MATCH SIMPLE
15     ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED;
16
17 -- Fix names in the org unit setting configuration
18
19 UPDATE config.org_unit_setting_type SET name = overlay(name placing 'aua' from 16 for 2) where name like 'ui.patron.edit.au.state.%';
20
21 -- Fix names if they have already been set in the editor
22
23 UPDATE actor.org_unit_setting SET name = overlay(name placing 'aua' from 16 for 2) where name like 'ui.patron.edit.au.state.%';
24
25 -- and the logs too
26
27 UPDATE config.org_unit_setting_type_log SET field_name = overlay(field_name placing 'aua' from 16 for 2) where field_name like 'ui.patron.edit.au.state.%';
28
29 COMMIT;