[open-ils-commits] r14173 - in trunk/Open-ILS/src/sql/Pg: . upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Sep 26 12:25:48 EDT 2009
Author: miker
Date: 2009-09-26 12:25:45 -0400 (Sat, 26 Sep 2009)
New Revision: 14173
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0025.schema.materialized_xact_summary-populate-xact_type.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/080.schema.money.sql
trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
trunk/Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql
Log:
Fix targetting trac ticket #70 -- populate the xact_type column in transaction summary materialization trigger
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-09-26 04:57:40 UTC (rev 14172)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-09-26 16:25:45 UTC (rev 14173)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0024'); -- phasefx
+INSERT INTO config.upgrade_log (version) VALUES ('0025'); -- miker
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/080.schema.money.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/080.schema.money.sql 2009-09-26 04:57:40 UTC (rev 14172)
+++ trunk/Open-ILS/src/sql/Pg/080.schema.money.sql 2009-09-26 16:25:45 UTC (rev 14173)
@@ -258,8 +258,8 @@
/* AFTER trigger only! */
CREATE OR REPLACE FUNCTION money.mat_summary_create () RETURNS TRIGGER AS $$
BEGIN
- INSERT INTO money.materialized_billable_xact_summary (id, usr, xact_start, xact_finish, total_paid, total_owed, balance_owed)
- VALUES ( NEW.id, NEW.usr, NEW.xact_start, NEW.xact_finish, 0.0, 0.0, 0.0);
+ INSERT INTO money.materialized_billable_xact_summary (id, usr, xact_start, xact_finish, total_paid, total_owed, balance_owed, xact_type)
+ VALUES ( NEW.id, NEW.usr, NEW.xact_start, NEW.xact_finish, 0.0, 0.0, 0.0, TG_ARGV[0]);
RETURN NEW;
END;
$$ LANGUAGE PLPGSQL;
@@ -284,7 +284,7 @@
END;
$$ LANGUAGE PLPGSQL;
-CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ();
+CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ('grocery');
CREATE TRIGGER mat_summary_change_tgr AFTER UPDATE ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_update ();
CREATE TRIGGER mat_summary_remove_tgr AFTER DELETE ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_delete ();
Modified: trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2009-09-26 04:57:40 UTC (rev 14172)
+++ trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2009-09-26 16:25:45 UTC (rev 14173)
@@ -148,7 +148,7 @@
CREATE UNIQUE INDEX circ_parent_idx ON action.circulation ( parent_circ ) WHERE parent_circ IS NOT NULL;
-CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ();
+CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ('circulation');
CREATE TRIGGER mat_summary_change_tgr AFTER UPDATE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_update ();
CREATE TRIGGER mat_summary_remove_tgr AFTER DELETE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_delete ();
Modified: trunk/Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql 2009-09-26 04:57:40 UTC (rev 14172)
+++ trunk/Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql 2009-09-26 16:25:45 UTC (rev 14173)
@@ -828,8 +828,8 @@
/* AFTER trigger only! */
CREATE OR REPLACE FUNCTION money.mat_summary_create () RETURNS TRIGGER AS $$
BEGIN
- INSERT INTO money.materialized_billable_xact_summary (id, usr, xact_start, xact_finish, total_paid, total_owed, balance_owed)
- VALUES ( NEW.id, NEW.usr, NEW.xact_start, NEW.xact_finish, 0.0, 0.0, 0.0);
+ INSERT INTO money.materialized_billable_xact_summary (id, usr, xact_start, xact_finish, total_paid, total_owed, balance_owed, xact_type)
+ VALUES ( NEW.id, NEW.usr, NEW.xact_start, NEW.xact_finish, 0.0, 0.0, 0.0, TG_ARGV[0]);
RETURN NEW;
END;
$$ LANGUAGE PLPGSQL;
@@ -854,7 +854,7 @@
END;
$$ LANGUAGE PLPGSQL;
-CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ();
+CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ('grocery');
CREATE TRIGGER mat_summary_change_tgr AFTER UPDATE ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_update ();
CREATE TRIGGER mat_summary_remove_tgr AFTER DELETE ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_delete ();
@@ -1096,7 +1096,7 @@
CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.credit_card_payment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('credit_card_payment');
-CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ();
+CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ('circulation');
CREATE TRIGGER mat_summary_change_tgr AFTER UPDATE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_update ();
CREATE TRIGGER mat_summary_remove_tgr AFTER DELETE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_delete ();
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0025.schema.materialized_xact_summary-populate-xact_type.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0025.schema.materialized_xact_summary-populate-xact_type.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0025.schema.materialized_xact_summary-populate-xact_type.sql 2009-09-26 16:25:45 UTC (rev 14173)
@@ -0,0 +1,24 @@
+
+-- Populate xact_type column in the materialized version of billable_xact_summary
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0025');
+
+CREATE OR REPLACE FUNCTION money.mat_summary_create () RETURNS TRIGGER AS $$
+BEGIN
+ INSERT INTO money.materialized_billable_xact_summary (id, usr, xact_start, xact_finish, total_paid, total_owed, balance_owed, xact_type)
+ VALUES ( NEW.id, NEW.usr, NEW.xact_start, NEW.xact_finish, 0.0, 0.0, 0.0, TG_ARGV[0]);
+ RETURN NEW;
+END;
+$$ LANGUAGE PLPGSQL;
+
+
+DROP TRIGGER mat_summary_create_tgr ON action.circulation;
+CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ('circulation');
+
+DROP TRIGGER mat_summary_create_tgr ON money.grocery;
+CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON money.grocery FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ('grocery');
+
+COMMIT;
+
More information about the open-ils-commits
mailing list