[open-ils-commits] r10180 - in branches/acq-experiment/Open-ILS:
examples src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 29 22:06:55 EDT 2008
Author: miker
Date: 2008-07-29 22:06:48 -0400 (Tue, 29 Jul 2008)
New Revision: 10180
Modified:
branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql
Log:
adding definition to lineitem_attr, and setting it for auto-attrs
Modified: branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
===================================================================
--- branches/acq-experiment/Open-ILS/examples/fm_IDL.xml 2008-07-29 20:56:38 UTC (rev 10179)
+++ branches/acq-experiment/Open-ILS/examples/fm_IDL.xml 2008-07-30 02:06:48 UTC (rev 10180)
@@ -3665,9 +3665,11 @@
<field reporter:label="Type" name="attr_type" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" />
<field reporter:label="Name" name="attr_name" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text" />
<field reporter:label="Value" name="attr_value" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="text" />
+ <field reporter:label="Definition" name="definition" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="text" />
</fields>
<links>
<link field="lineitem" reltype="has_a" key="id" map="" class="jub"/>
+ <link field="definition" reltype="has_a" key="id" map="" class="acqliad"/>
</links>
</class>
Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql 2008-07-29 20:56:38 UTC (rev 10179)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql 2008-07-30 02:06:48 UTC (rev 10180)
@@ -166,16 +166,6 @@
CREATE INDEX li_detail_li_idx ON acq.lineitem_detail (lineitem);
-CREATE TABLE acq.lineitem_attr (
- id BIGSERIAL PRIMARY KEY,
- lineitem BIGINT NOT NULL REFERENCES acq.lineitem (id),
- attr_type TEXT NOT NULL,
- attr_name TEXT NOT NULL,
- attr_value TEXT NOT NULL
-);
-
-CREATE INDEX li_attr_li_idx ON acq.lineitem_attr (lineitem);
-
CREATE TABLE acq.lineitem_attr_definition (
id BIGSERIAL PRIMARY KEY,
code TEXT NOT NULL,
@@ -209,7 +199,18 @@
id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq')
) INHERITS (acq.lineitem_attr_definition);
+CREATE TABLE acq.lineitem_attr (
+ id BIGSERIAL PRIMARY KEY,
+ definition BIGINT NOT NULL,
+ lineitem BIGINT NOT NULL REFERENCES acq.lineitem (id),
+ attr_type TEXT NOT NULL,
+ attr_name TEXT NOT NULL,
+ attr_value TEXT NOT NULL
+);
+CREATE INDEX li_attr_li_idx ON acq.lineitem_attr (lineitem);
+
+
-- Seed data
@@ -283,7 +284,8 @@
SELECT extract_acq_marc_field(id, xpath_string, adef.remove) INTO value FROM acq.lineitem WHERE id = NEW.id;
IF (value IS NOT NULL AND value <> '') THEN
- INSERT INTO acq.lineitem_attr (lineitem, attr_type, attr_name, attr_value) VALUES (NEW.id, atype, adef.code, value);
+ INSERT INTO acq.lineitem_attr (lineitem, definition, attr_type, attr_name, attr_value)
+ VALUES (NEW.id, adef.id, atype, adef.code, value);
END IF;
END IF;
More information about the open-ils-commits
mailing list