[open-ils-commits] r12623 - trunk/Open-ILS/src/sql/Pg (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 20 08:42:03 EDT 2009
Author: scottmk
Date: 2009-03-20 08:42:01 -0400 (Fri, 20 Mar 2009)
New Revision: 12623
Modified:
trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
Log:
Create two new tables: acq.distribution_formula
and acq.distribution_formula_entry.
Modified: trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2009-03-20 02:13:03 UTC (rev 12622)
+++ trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2009-03-20 12:42:01 UTC (rev 12623)
@@ -273,6 +273,30 @@
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
More information about the open-ils-commits
mailing list