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
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 (