Add a po_item column, pointing to acq.po_item, to acq.invoice_item.
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 28 Apr 2010 19:28:45 +0000 (19:28 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 28 Apr 2010 19:28:45 +0000 (19:28 +0000)
M    Open-ILS/src/sql/Pg/200.schema.acq.sql
M    Open-ILS/src/sql/Pg/002.schema.config.sql
A    Open-ILS/src/sql/Pg/upgrade/0243.schema.acq-inv-item-po-item.sql
M    Open-ILS/examples/fm_IDL.xml

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16337 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/0243.schema.acq-inv-item-po-item.sql [new file with mode: 0644]

index e909f1b..d1da75a 100644 (file)
@@ -4731,6 +4731,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Actual Cost" name="actual_cost" reporter:datatype="money" />
                        <field reporter:label="Fund" name="fund" reporter:datatype="link" />
                        <field reporter:label="Amount Paid" name="amount_paid" reporter:datatype="money" />
+                       <field reporter:label="Purchase Order Item" name="po_item" reporter:datatype="link" />
                </fields>
                <links>
                        <link field="invoice" reltype="has_a" key="id" map="" class="acqinv"/>
@@ -4738,6 +4739,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="fund_debit" reltype="has_a" key="id" map="" class="acqfdeb"/>
                        <link field="inv_item_type" reltype="has_a" key="code" map="" class="aiit"/>
                        <link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
+                       <link field="po_item" reltype="has_a" key="id" map="" class="acqpoi"/>
                </links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
index 790c445..d1cc354 100644 (file)
@@ -60,7 +60,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0242'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0243'); -- Scott McKellar
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index bf678e7..2293ac1 100644 (file)
@@ -828,22 +828,6 @@ CREATE TABLE acq.invoice_item_type (
        prorate BOOL    NOT NULL DEFAULT FALSE
 );
 
-CREATE TABLE acq.invoice_item ( -- for invoice-only debits: taxes/fees/non-bib items/etc
-    id              SERIAL      PRIMARY KEY,
-    invoice         INT         NOT NULL REFERENCES acq.invoice (id) ON UPDATE CASCADE ON DELETE CASCADE,
-    purchase_order  INT         REFERENCES acq.purchase_order (id) ON UPDATE CASCADE ON DELETE SET NULL,
-    fund_debit      INT         REFERENCES acq.fund_debit (id),
-    inv_item_type   TEXT        NOT NULL REFERENCES acq.invoice_item_type (code),
-    title           TEXT,
-    author          TEXT,
-    note            TEXT,
-    cost_billed     NUMERIC(8,2),
-    actual_cost     NUMERIC(8,2),
-       fund            INT         REFERENCES acq.fund (id)
-                                   DEFERRABLE INITIALLY DEFERRED,
-       amount_paid     NUMERIC (8,2)
-);
-
 CREATE TABLE acq.po_item (
        id              SERIAL      PRIMARY KEY,
        purchase_order  INT         REFERENCES acq.purchase_order (id)
@@ -862,6 +846,24 @@ CREATE TABLE acq.po_item (
                                    DEFERRABLE INITIALLY DEFERRED
 );
 
+CREATE TABLE acq.invoice_item ( -- for invoice-only debits: taxes/fees/non-bib items/etc
+    id              SERIAL      PRIMARY KEY,
+    invoice         INT         NOT NULL REFERENCES acq.invoice (id) ON UPDATE CASCADE ON DELETE CASCADE,
+    purchase_order  INT         REFERENCES acq.purchase_order (id) ON UPDATE CASCADE ON DELETE SET NULL,
+    fund_debit      INT         REFERENCES acq.fund_debit (id),
+    inv_item_type   TEXT        NOT NULL REFERENCES acq.invoice_item_type (code),
+    title           TEXT,
+    author          TEXT,
+    note            TEXT,
+    cost_billed     NUMERIC(8,2),
+    actual_cost     NUMERIC(8,2),
+       fund            INT         REFERENCES acq.fund (id)
+                                   DEFERRABLE INITIALLY DEFERRED,
+       amount_paid     NUMERIC (8,2),
+       po_item         INT         REFERENCES acq.po_item (id)
+                                   DEFERRABLE INITIALLY DEFERRED
+);
+
 -- Patron requests
 CREATE TABLE acq.user_request_type (
     id      SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0243.schema.acq-inv-item-po-item.sql b/Open-ILS/src/sql/Pg/upgrade/0243.schema.acq-inv-item-po-item.sql
new file mode 100644 (file)
index 0000000..a772843
--- /dev/null
@@ -0,0 +1,9 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0243'); -- Scott McKellar
+
+ALTER TABLE acq.invoice_item
+       ADD COLUMN po_item INT REFERENCES acq.po_item (id)
+                              DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;