Make the foreign key relationship between acq.invoice_item and
acq.fund_debit deferrable so that fund debits can be deleted in the
same transactions as the invoice items. Otherwise, the fund debits
cannot be deleted if at all if referenced by an invoice item.
Signed-off-by: Jason Stephenson <jason@sigio.com>
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),
+ fund_debit INT REFERENCES acq.fund_debit (id) DEFERRABLE INITIALLY DEFERRED,
inv_item_type TEXT NOT NULL REFERENCES acq.invoice_item_type (code),
title TEXT,
author TEXT,
--- /dev/null
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE acq.invoice_item ALTER CONSTRAINT invoice_item_fund_debit_fkey DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;
* `autogen.sh` can now accept a `-c` switch to specify the location of `opensrf_core.xml`. This is useful for certain multi-tenant setups of Evergreen. (LP#2003707)
* Better organization of acquisitions line item alert fields (LP#2002977)
* Prevent templates from applying or changing magical status in angular holdings editor (LP#1999401)
+* Make the foreign key relationship between the acq.invoice_item and acq.fund_debit tables deferrable so that fund debits can be deleted when they reference invoice items that are deleted in the same transaction. (LP#2009066)