From 365e63f7838a89f0d3443eb0c67facec498cdb48 Mon Sep 17 00:00:00 2001 From: scottmk Date: Wed, 28 Apr 2010 19:28:45 +0000 Subject: [PATCH] Add a po_item column, pointing to acq.po_item, to acq.invoice_item. 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 | 2 ++ Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/200.schema.acq.sql | 34 ++++++++++++---------- .../upgrade/0243.schema.acq-inv-item-po-item.sql | 9 ++++++ 4 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0243.schema.acq-inv-item-po-item.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index e909f1b7f..d1da75aa3 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4731,6 +4731,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + @@ -4738,6 +4739,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 790c44546..d1cc35489 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -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, diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index bf678e723..2293ac1e2 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -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 index 000000000..a772843d3 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0243.schema.acq-inv-item-po-item.sql @@ -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; -- 2.11.0