From: Galen Charlton Date: Mon, 17 Aug 2020 19:26:21 +0000 (-0400) Subject: DB/IDL add primary_contact column to acq.provider X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4548217cc49cb132a1afdd850789ce84f5ff0f92;p=working%2FEvergreen.git DB/IDL add primary_contact column to acq.provider Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 842eae9f29..d6b95fba42 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -8801,6 +8801,7 @@ SELECT usr, + @@ -8813,6 +8814,7 @@ SELECT usr, + diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index ce23237f34..2ddf74eb0b 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -84,6 +84,7 @@ CREATE TABLE acq.provider ( default_copy_count INT NOT NULL DEFAULT 0, default_claim_policy INT REFERENCES acq.claim_policy DEFERRABLE INITIALLY DEFERRED, + primary_contact INT, -- REFERENCE acq.provider_contact(id) ON DELETE SET NULL ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner), CONSTRAINT code_once_per_owner UNIQUE (code, owner) ); diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql index 58181cb21d..9ec6446bb4 100644 --- a/Open-ILS/src/sql/Pg/800.fkeys.sql +++ b/Open-ILS/src/sql/Pg/800.fkeys.sql @@ -66,6 +66,7 @@ ALTER TABLE actor.org_unit_proximity_adjustment ADD CONSTRAINT actor_org_unit_pr ALTER TABLE actor.org_unit_proximity_adjustment ADD CONSTRAINT actor_org_unit_proximity_copy_location_fkey FOREIGN KEY (copy_location) REFERENCES asset.copy_location (id) DEFERRABLE INITIALLY DEFERRED; ALTER TABLE acq.provider ADD CONSTRAINT acq_provider_edi_default_fkey FOREIGN KEY (edi_default) REFERENCES acq.edi_account (id) DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE acq.provider ADD CONSTRAINT acq_provider_primary_contact_fkey FOREIGN KEY (primary_contact) REFERENCES acq.provider_contact (id) ON DELETE SET NULL ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED; ALTER TABLE biblio.record_note ADD CONSTRAINT biblio_record_note_record_fkey FOREIGN KEY (record) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ALTER TABLE biblio.record_note ADD CONSTRAINT biblio_record_note_creator_fkey FOREIGN KEY (creator) REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED; diff --git a/Open-ILS/src/sql/Pg/upgrade/AAAA.schema.provider-primary-contact.sql b/Open-ILS/src/sql/Pg/upgrade/AAAA.schema.provider-primary-contact.sql new file mode 100644 index 0000000000..b95f456bd8 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/AAAA.schema.provider-primary-contact.sql @@ -0,0 +1,8 @@ +BEGIN; + +-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +ALTER TABLE acq.provider ADD COLUMN primary_contact INT; +ALTER TABLE acq.provider ADD CONSTRAINT acq_provider_primary_contact_fkey FOREIGN KEY (primary_contact) REFERENCES acq.provider_contact (id) ON DELETE SET NULL ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED; + +COMMIT;