From 36e6d9d1aa0873d7921bf6378d686c23ef623708 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Thu, 21 Nov 2019 16:20:02 -0500 Subject: [PATCH] Sidestep dependency created by conifer.last_use view Signed-off-by: Dan Scott --- .../src/sql/Pg/version-upgrade/3.1.5-3.2.0-upgrade-db.sql | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/sql/Pg/version-upgrade/3.1.5-3.2.0-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/3.1.5-3.2.0-upgrade-db.sql index 8a9940b914..79ad511f4c 100644 --- a/Open-ILS/src/sql/Pg/version-upgrade/3.1.5-3.2.0-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/version-upgrade/3.1.5-3.2.0-upgrade-db.sql @@ -2217,6 +2217,8 @@ $$ ( currval('action_trigger.event_definition_id_seq'), 'circ_lib' ); +-- Custom view depends on this +DROP VIEW conifer.last_use; DROP VIEW action.all_circulation; CREATE OR REPLACE VIEW action.all_circulation AS SELECT id,usr_post_code, usr_home_ou, usr_profile, usr_birth_year, copy_call_number, copy_location, @@ -2410,7 +2412,16 @@ BEGIN END; $$ LANGUAGE 'plpgsql'; - +-- Recreate conifer view +CREATE VIEW conifer.last_use AS + SELECT ac.id, + COALESCE(max(actac.xact_start), ac.create_date) AS last_circ_or_create, + max(actac.xact_start) AS last_circ, + max(aih.use_time) AS last_use + FROM asset.copy ac + LEFT JOIN action.all_circulation actac ON ac.id = actac.target_copy + LEFT JOIN action.in_house_use aih ON ac.id = aih.item + GROUP BY ac.id; SELECT evergreen.upgrade_deps_block_check('1124', :eg_version); -- 2.11.0