From 640662feefb62aabdfe673f5614f2dafdff4c0df Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 3 Aug 2011 12:45:37 -0400 Subject: [PATCH] Upgrade script for a patch from Steven Callender addressing payment types in money.materialized_summary_payment Signed-off-by: Mike Rylander --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- ...money.materialized_summary_payment-triggers.sql | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0589.money.materialized_summary_payment-triggers.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 3fd9e180fe..ed6a491a99 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -57,7 +57,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0588'); -- miker/berick +INSERT INTO config.upgrade_log (version) VALUES ('0589'); -- scallender/miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0589.money.materialized_summary_payment-triggers.sql b/Open-ILS/src/sql/Pg/upgrade/0589.money.materialized_summary_payment-triggers.sql new file mode 100644 index 0000000000..30e526c517 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0589.money.materialized_summary_payment-triggers.sql @@ -0,0 +1,22 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0589'); + +DROP TRIGGER IF EXISTS mat_summary_add_tgr ON money.cash_payment; +DROP TRIGGER IF EXISTS mat_summary_upd_tgr ON money.cash_payment; +DROP TRIGGER IF EXISTS mat_summary_del_tgr ON money.cash_payment; + +CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.cash_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('cash_payment'); +CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.cash_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('cash_payment'); +CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.cash_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('cash_payment'); + +DROP TRIGGER IF EXISTS mat_summary_add_tgr ON money.check_payment; +DROP TRIGGER IF EXISTS mat_summary_upd_tgr ON money.check_payment; +DROP TRIGGER IF EXISTS mat_summary_del_tgr ON money.check_payment; + +CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.check_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('check_payment'); +CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.check_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('check_payment'); +CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.check_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('check_payment'); + +COMMIT; + -- 2.11.0