]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/1064.schema.issuance_scap_fkey.sql
LP1894131 Sticky catalog holdings org select
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 1064.schema.issuance_scap_fkey.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('1064', :eg_version);
4
5 ALTER TABLE serial.issuance DROP CONSTRAINT IF EXISTS issuance_caption_and_pattern_fkey;
6
7 -- Using NOT VALID and VALIDATE CONSTRAINT limits the impact to concurrent work.
8 -- For details, see: https://www.postgresql.org/docs/current/static/sql-altertable.html
9
10 ALTER TABLE serial.issuance ADD CONSTRAINT issuance_caption_and_pattern_fkey
11     FOREIGN KEY (caption_and_pattern)
12     REFERENCES serial.caption_and_pattern (id)
13     ON DELETE CASCADE
14     DEFERRABLE INITIALLY DEFERRED
15     NOT VALID;
16
17 ALTER TABLE serial.issuance VALIDATE CONSTRAINT issuance_caption_and_pattern_fkey;
18
19 COMMIT;
20