From b18a66680fa22d1e127be052fafaa8b39fc68cb5 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 31 Aug 2016 10:28:05 -0400 Subject: [PATCH] JBAS-1419 CO history handles serials copies Cross-port 6479b578. Signed-off-by: Bill Erickson --- KCLS/sql/schema/deploy/patron-co-history-table.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/KCLS/sql/schema/deploy/patron-co-history-table.sql b/KCLS/sql/schema/deploy/patron-co-history-table.sql index c3840e3794..46ef1e35b0 100644 --- a/KCLS/sql/schema/deploy/patron-co-history-table.sql +++ b/KCLS/sql/schema/deploy/patron-co-history-table.sql @@ -13,13 +13,17 @@ CREATE TABLE action.usr_circ_history ( usr INTEGER NOT NULL REFERENCES actor.usr(id) DEFERRABLE INITIALLY DEFERRED, xact_start TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), - target_copy BIGINT NOT NULL, + target_copy BIGINT NOT NULL, -- asset.copy.id / serial.unit.id due_date TIMESTAMP WITH TIME ZONE NOT NULL, checkin_time TIMESTAMP WITH TIME ZONE, source_circ BIGINT REFERENCES action.circulation(id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED ); +CREATE TRIGGER action_usr_circ_history_target_copy_trig + AFTER INSERT OR UPDATE ON action.usr_circ_history + FOR EACH ROW EXECUTE PROCEDURE evergreen.fake_fkey_tgr('target_copy'); + CREATE OR REPLACE FUNCTION action.maintain_usr_circ_history() RETURNS TRIGGER AS $FUNK$ DECLARE -- 2.11.0