The money.transaction_billing_summary view was showing the wrong
last billing type and last billing note for certain transactions.
This fix, from Dan Scott, in turn from Mike Rylander, recreates
that view so that it depends on the speedier and more accurate
money.materialized_billable_xact_summary view.
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
ORDER BY MAX(billing_ts);
CREATE OR REPLACE VIEW money.transaction_billing_summary AS
- SELECT xact,
- LAST(billing_type) AS last_billing_type,
- LAST(note) AS last_billing_note,
- MAX(billing_ts) AS last_billing_ts,
- SUM(COALESCE(amount,0)) AS total_owed
- FROM money.billing
- WHERE voided IS FALSE
- GROUP BY xact
- ORDER BY MAX(billing_ts);
+ SELECT id as xact,
+ last_billing_type,
+ last_billing_note,
+ last_billing_ts,
+ total_owed
+ FROM money.materialized_billable_xact_summary;
+
CREATE OR REPLACE VIEW money.transaction_payment_summary AS
SELECT xact,
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE VIEW money.transaction_billing_summary AS
+ SELECT id as xact,
+ last_billing_type,
+ last_billing_note,
+ last_billing_ts,
+ total_owed
+ FROM money.materialized_billable_xact_summary;
+
+COMMIT;