From 8d34bf74ced23f7924895624510625a3c07b0339 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 21 Dec 2015 10:39:07 -0500 Subject: [PATCH] LP#1527342 SQL / IDL Signed-off-by: Bill Erickson --- Open-ILS/examples/fm_IDL.xml | 22 +++++++++++++++++++++- .../Pg/upgrade/XXXX.schema.decouple_co_history.sql | 21 ++++++++++++++++----- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 8cff802157..732a8b6a54 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4261,7 +4261,27 @@ SELECT usr, - + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.decouple_co_history.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.decouple_co_history.sql index 5065ae6d73..f070f58271 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.decouple_co_history.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.decouple_co_history.sql @@ -81,12 +81,12 @@ BEGIN WHERE source_circ = first_circ AND ( - due_date <> NEW.due_date OR - -- coalesce on a common value so we can <> compare NULL's - COALESCE(checkin_time, NEW.xact_start) <> - COALESCE(NEW.checkin_time, NEW.xact_start) + due_date <> NEW.due_date OR ( + (checkin_time IS NULL AND NEW.checkin_time IS NOT NULL) OR + (checkin_time IS NOT NULL AND NEW.checkin_time IS NULL) OR + (checkin_time <> NEW.checkin_time) + ) ); - RETURN NEW; END; $FUNK$ LANGUAGE PLPGSQL; @@ -97,3 +97,14 @@ CREATE TRIGGER maintain_usr_circ_history_tgr COMMIT; +/* REVERT -- */ +/* +BEGIN; + +DROP TRIGGER IF EXISTS maintain_usr_circ_history_tgr ON action.circulation; +DROP FUNCTION IF EXISTS action.maintain_usr_circ_history(); +DROP TABLE action.usr_circ_history; + +COMMIT; +*/ + -- 2.11.0