From: dbs Date: Tue, 9 Mar 2010 12:09:06 +0000 (+0000) Subject: Also upgrade the money.materialized_summary_billing_add () function to maintain mmbxs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c94670c71771ee2d7be0d31d7cc664a452d036ae;p=Evergreen.git Also upgrade the money.materialized_summary_billing_add () function to maintain mmbxs git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6_0@15756 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql index ad3891a7c6..a27980276a 100644 --- a/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/1.6.0.3-1.6.0.4-upgrade-db.sql @@ -132,6 +132,18 @@ CREATE OR REPLACE VIEW money.billable_xact_summary AS ) credit ON xact.id = credit.xact ORDER BY debit.billing_ts, credit.payment_ts; +/* BEFORE or AFTER trigger only! */ +CREATE OR REPLACE FUNCTION money.mat_summary_update () RETURNS TRIGGER AS $$ +BEGIN + UPDATE money.materialized_billable_xact_summary + SET usr = NEW.usr, + xact_start = NEW.xact_start, + xact_finish = NEW.xact_finish + WHERE id = NEW.id; + RETURN NEW; +END; +$$ LANGUAGE PLPGSQL; + -- And rebuild the materialized view that was built on money.billable_xact_summary TRUNCATE TABLE money.materialized_billable_xact_summary; INSERT INTO TABLE money.materialized_billable_xact_summary