]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/1032.schema.all_circulation_combined_types_view.sql
LP1779158 Angular7 and ng-lint updates
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 1032.schema.all_circulation_combined_types_view.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('1032', :eg_version); -- Bmagic/csharp/gmcharlt
4
5 CREATE OR REPLACE VIEW action.all_circulation_combined_types AS 
6  SELECT acirc.id AS id,
7     acirc.xact_start,
8     acirc.circ_lib,
9     acirc.circ_staff,
10     acirc.create_time,
11     ac_acirc.circ_modifier AS item_type,
12     'regular_circ'::text AS circ_type
13    FROM action.circulation acirc,
14     asset.copy ac_acirc
15   WHERE acirc.target_copy = ac_acirc.id
16 UNION ALL
17  SELECT ancc.id::BIGINT AS id,
18     ancc.circ_time AS xact_start,
19     ancc.circ_lib,
20     ancc.staff AS circ_staff,
21     ancc.circ_time AS create_time,
22     cnct_ancc.name AS item_type,
23     'non-cat_circ'::text AS circ_type
24    FROM action.non_cataloged_circulation ancc,
25     config.non_cataloged_type cnct_ancc
26   WHERE ancc.item_type = cnct_ancc.id
27 UNION ALL
28  SELECT aihu.id::BIGINT AS id,
29     aihu.use_time AS xact_start,
30     aihu.org_unit AS circ_lib,
31     aihu.staff AS circ_staff,
32     aihu.use_time AS create_time,
33     ac_aihu.circ_modifier AS item_type,
34     'in-house_use'::text AS circ_type
35    FROM action.in_house_use aihu,
36     asset.copy ac_aihu
37   WHERE aihu.item = ac_aihu.id
38 UNION ALL
39  SELECT ancihu.id::BIGINT AS id,
40     ancihu.use_time AS xact_start,
41     ancihu.org_unit AS circ_lib,
42     ancihu.staff AS circ_staff,
43     ancihu.use_time AS create_time,
44     cnct_ancihu.name AS item_type,
45     'non-cat_circ'::text AS circ_type
46    FROM action.non_cat_in_house_use ancihu,
47     config.non_cataloged_type cnct_ancihu
48   WHERE ancihu.item_type = cnct_ancihu.id
49 UNION ALL
50  SELECT aacirc.id AS id,
51     aacirc.xact_start,
52     aacirc.circ_lib,
53     aacirc.circ_staff,
54     aacirc.create_time,
55     ac_aacirc.circ_modifier AS item_type,
56     'aged_circ'::text AS circ_type
57    FROM action.aged_circulation aacirc,
58     asset.copy ac_aacirc
59   WHERE aacirc.target_copy = ac_aacirc.id;
60
61 COMMIT;