From a2610c565e06ff573d8b841178de742a96238c47 Mon Sep 17 00:00:00 2001 From: scottmk Date: Fri, 20 Mar 2009 12:42:01 +0000 Subject: [PATCH] Create two new tables: acq.distribution_formula and acq.distribution_formula_entry. git-svn-id: svn://svn.open-ils.org/ILS/trunk@12623 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/200.schema.acq.sql | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index c468173376..6b82abade4 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -273,6 +273,30 @@ INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUE INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('edition','Edition','//*[@tag="250"]/*[@code="a"][1]'); +CREATE TABLE acq.distribution_formula ( + id SERIAL PRIMARY KEY, + owner INT NOT NULL + REFERENCES actor.org_unit(id) DEFERRABLE INITIALLY DEFERRED, + name TEXT NOT NULL, + skip_count INT NOT NULL DEFAULT 0, + CONSTRAINT acqdf_name_once_per_owner UNIQUE (name, owner) +); + +CREATE TABLE acq.distribution_formula_entry ( + id SERIAL PRIMARY KEY, + formula INTEGER NOT NULL REFERENCES acq.distribution_formula(id) + DEFERRABLE INITIALLY DEFERRED, + position INTEGER NOT NULL, + item_count INTEGER NOT NULL, + owning_lib INTEGER REFERENCES actor.org_unit(id) + DEFERRABLE INITIALLY DEFERRED, + location INTEGER REFERENCES asset.copy_location(id), + CONSTRAINT acqdfe_lib_once_per_formula UNIQUE( formula, position ), + CONSTRAINT acqdfe_must_be_somewhere + CHECK( owning_lib IS NOT NULL OR location IS NOT NULL ) +); + + -- Functions -- 2.11.0