acq.funding_source.code currently has a UNIQUE
constraint applied, which can be confusing to
users. This branch only requires that a code be
unique to the funding source's owner, simplifying
the management of funding sources.
Signed-off-by: Jason Boyer <JBoyer@library.in.gov>
Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
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,
+ CONSTRAINT funding_source_code_once_per_owner UNIQUE (code,owner),
CONSTRAINT funding_source_name_once_per_owner UNIQUE (name,owner)
);
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE acq.funding_source DROP CONSTRAINT funding_source_code_key;
+ALTER TABLE acq.funding_source ALTER COLUMN code SET NOT NULL;
+ALTER TABLE acq.funding_source ADD CONSTRAINT funding_source_code_once_per_owner UNIQUE (code,owner);
+
+COMMIT;
--- /dev/null
+Funding Source Codes are now Unique per Owner
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Funding source codes had to be unique across an
+entire installation which is aggravating when
+you can't actually see the other source codes.
+
+Now multiple locations can have the same codes if
+they desire.
+