LP#1599634 - Remove DROP VIEW statement, add .sql to name.
authorChris Sharp <csharp@georgialibraries.org>
Fri, 15 Jul 2016 20:09:56 +0000 (16:09 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Sun, 17 Sep 2017 20:28:13 +0000 (16:28 -0400)
When running the upgrade script, the DROP VIEW statement resulted in an
error since the view did not already exist.  You could add IF EXISTS, but
CREATE OR REPLACE VIEW is sufficient.

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/sql/Pg/upgrade/XXXX.LP1599634_Circulation_report_source_to_include_in-house_and_non_cat_circ [deleted file]
Open-ILS/src/sql/Pg/upgrade/XXXX.LP1599634_Circulation_report_source_to_include_in-house_and_non_cat_circ.sql [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1599634_Circulation_report_source_to_include_in-house_and_non_cat_circ b/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1599634_Circulation_report_source_to_include_in-house_and_non_cat_circ
deleted file mode 100644 (file)
index 8042c32..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-BEGIN;
-
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-DROP VIEW action.all_circulation_combined_types;
-
-CREATE OR REPLACE VIEW action.all_circulation_combined_types AS 
- SELECT 'regularcirc'::text || acirc.id AS id,
-    acirc.xact_start,
-    acirc.circ_lib,
-    acirc.circ_staff,
-    acirc.create_time,
-    ac_acirc.circ_modifier AS item_type,
-    'regular_circ'::text AS circ_type
-   FROM action.circulation acirc,
-    asset.copy ac_acirc
-  WHERE acirc.target_copy = ac_acirc.id
-UNION ALL
- SELECT 'noncatcirc'::text || ancc.id AS id,
-    ancc.circ_time AS xact_start,
-    ancc.circ_lib,
-    ancc.staff AS circ_staff,
-    ancc.circ_time AS create_time,
-    cnct_ancc.name AS item_type,
-    'non-cat_circ'::text AS circ_type
-   FROM action.non_cataloged_circulation ancc,
-    config.non_cataloged_type cnct_ancc
-  WHERE ancc.item_type = cnct_ancc.id
-UNION ALL
- SELECT 'inhouseuse'::text || aihu.id AS id,
-    aihu.use_time AS xact_start,
-    aihu.org_unit AS circ_lib,
-    aihu.staff AS circ_staff,
-    aihu.use_time AS create_time,
-    ac_aihu.circ_modifier AS item_type,
-    'in-house_use'::text AS circ_type
-   FROM action.in_house_use aihu,
-    asset.copy ac_aihu
-  WHERE aihu.item = ac_aihu.id
-UNION ALL
- SELECT 'noncatinhouseuse'::text || ancihu.id AS id,
-    ancihu.use_time AS xact_start,
-    ancihu.org_unit AS circ_lib,
-    ancihu.staff AS circ_staff,
-    ancihu.use_time AS create_time,
-    cnct_ancihu.name AS item_type,
-    'non-cat_circ'::text AS circ_type
-   FROM action.non_cat_in_house_use ancihu,
-    config.non_cataloged_type cnct_ancihu
-  WHERE ancihu.item_type = cnct_ancihu.id
-UNION ALL
- SELECT 'agedcirc'::text || aacirc.id::text AS id,
-    aacirc.xact_start,
-    aacirc.circ_lib,
-    aacirc.circ_staff,
-    aacirc.create_time,
-    ac_aacirc.circ_modifier AS item_type,
-    'aged_circ'::text AS circ_type
-   FROM action.aged_circulation aacirc,
-    asset.copy ac_aacirc
-  WHERE aacirc.target_copy = ac_aacirc.id;
-
-COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1599634_Circulation_report_source_to_include_in-house_and_non_cat_circ.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1599634_Circulation_report_source_to_include_in-house_and_non_cat_circ.sql
new file mode 100644 (file)
index 0000000..76061cc
--- /dev/null
@@ -0,0 +1,61 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE VIEW action.all_circulation_combined_types AS 
+ SELECT 'regularcirc'::text || acirc.id AS id,
+    acirc.xact_start,
+    acirc.circ_lib,
+    acirc.circ_staff,
+    acirc.create_time,
+    ac_acirc.circ_modifier AS item_type,
+    'regular_circ'::text AS circ_type
+   FROM action.circulation acirc,
+    asset.copy ac_acirc
+  WHERE acirc.target_copy = ac_acirc.id
+UNION ALL
+ SELECT 'noncatcirc'::text || ancc.id AS id,
+    ancc.circ_time AS xact_start,
+    ancc.circ_lib,
+    ancc.staff AS circ_staff,
+    ancc.circ_time AS create_time,
+    cnct_ancc.name AS item_type,
+    'non-cat_circ'::text AS circ_type
+   FROM action.non_cataloged_circulation ancc,
+    config.non_cataloged_type cnct_ancc
+  WHERE ancc.item_type = cnct_ancc.id
+UNION ALL
+ SELECT 'inhouseuse'::text || aihu.id AS id,
+    aihu.use_time AS xact_start,
+    aihu.org_unit AS circ_lib,
+    aihu.staff AS circ_staff,
+    aihu.use_time AS create_time,
+    ac_aihu.circ_modifier AS item_type,
+    'in-house_use'::text AS circ_type
+   FROM action.in_house_use aihu,
+    asset.copy ac_aihu
+  WHERE aihu.item = ac_aihu.id
+UNION ALL
+ SELECT 'noncatinhouseuse'::text || ancihu.id AS id,
+    ancihu.use_time AS xact_start,
+    ancihu.org_unit AS circ_lib,
+    ancihu.staff AS circ_staff,
+    ancihu.use_time AS create_time,
+    cnct_ancihu.name AS item_type,
+    'non-cat_circ'::text AS circ_type
+   FROM action.non_cat_in_house_use ancihu,
+    config.non_cataloged_type cnct_ancihu
+  WHERE ancihu.item_type = cnct_ancihu.id
+UNION ALL
+ SELECT 'agedcirc'::text || aacirc.id::text AS id,
+    aacirc.xact_start,
+    aacirc.circ_lib,
+    aacirc.circ_staff,
+    aacirc.create_time,
+    ac_aacirc.circ_modifier AS item_type,
+    'aged_circ'::text AS circ_type
+   FROM action.aged_circulation aacirc,
+    asset.copy ac_aacirc
+  WHERE aacirc.target_copy = ac_aacirc.id;
+
+COMMIT;