From: Dan Scott Date: Thu, 21 Nov 2019 21:20:02 +0000 (-0500) Subject: Sidestep dependency created by conifer.last_use view X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=75e4f46b23fe0850ae1c11b18effa0be2fa172fc;p=contrib%2FConifer.git Sidestep dependency created by conifer.last_use view Signed-off-by: Dan Scott --- 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);