From: scottmk Date: Mon, 24 Aug 2009 17:49:26 +0000 (+0000) Subject: Change constraint on acq.provider. Instead of making code unique X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=dbd4db5c08b96af9d2cefe2fa97eb2ec3e96734f;p=evergreen%2Ftadl.git Change constraint on acq.provider. Instead of making code unique by itself, make code + owner unique. To change an existing table: ALTER TABLE acq.provider DROP CONSTRAINT provider_code_key; ALTER TABLE acq.provider ALTER COLUMN code SET NOT NULL; ALTER TABLE acq.provider ADD CONSTRAINT code_once_per_owner UNIQUE (code, owner); git-svn-id: svn://svn.open-ils.org/ILS/trunk@13926 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index bacce5dbdb..131347d4b0 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -34,9 +34,10 @@ CREATE TABLE acq.provider ( name TEXT NOT NULL, owner INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, currency_type TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED, - code TEXT UNIQUE, + code TEXT NOT NULL, holding_tag TEXT, - CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner) + CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner), + CONSTRAINT code_once_per_owner UNIQUE (code, owner) ); CREATE TABLE acq.provider_holding_subfield_map (