LP#1380709 Fund debit links to invoice entry
authorBill Erickson <berickxx@gmail.com>
Thu, 16 Oct 2014 20:17:16 +0000 (16:17 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Fund debits created by lineitem_details (copies) now track which invoice
entry last touched the fund debit.  With this, it's possible to say with
certainty which invoice a fund_debit "belongs" to, which is particularly
useful for reporting fund summary information on an invoice.

Note this has no affect fund_debit's linked to invoice_item's, since
they already link to the fund debits.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fund_debit_invoice_links.sql [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fund_debit_invoice_links.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fund_debit_invoice_links.sql
new file mode 100644 (file)
index 0000000..aca7918
--- /dev/null
@@ -0,0 +1,10 @@
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE acq.fund_debit 
+    ADD COLUMN invoice_entry INTEGER 
+        REFERENCES acq.invoice_entry (id)
+        ON DELETE SET NULL;
+
+COMMIT;