From 69346646bda420fb2a91c07d0b9c680aa633db8c Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Tue, 18 Feb 2020 15:35:56 -0500 Subject: [PATCH] change module to be the comment --- route_sql/addmonth_vupd.sql | 8 ++++---- route_sql/build/build_fcpool.sql | 15 +++++++++------ route_sql/get_pool.sql | 4 ++-- route_sql/new_basket.sql | 6 +++--- route_sql/scale_pd.sql | 6 +++--- route_sql/scale_vd.sql | 6 +++--- route_sql/scale_vupd.sql | 8 ++++---- 7 files changed, 28 insertions(+), 25 deletions(-) diff --git a/route_sql/addmonth_vupd.sql b/route_sql/addmonth_vupd.sql index 9f8bac4..1f48044 100644 --- a/route_sql/addmonth_vupd.sql +++ b/route_sql/addmonth_vupd.sql @@ -333,7 +333,7 @@ SELECT ,'replace_source'||' volume' iter ,log.id ,COALESCE(log.doc->>'tag','') "tag" - ,log.doc->>'type' module + ,log.doc->>'message' "comment" FROM basemix b CROSS JOIN vscale s @@ -421,7 +421,7 @@ SELECT ,'replace_source'||' volume' iter ,log.id ,COALESCE(log.doc->>'tag','') "tag" - ,log.doc->>'type' module + ,log.doc->>'message' "comment" FROM volume b CROSS JOIN pscale p @@ -467,7 +467,7 @@ FROM ,iter ,logid ,tag - ,module + ,comment --------values------------------------- ,sum(value_loc) value_loc ,sum(value_usd) value_usd @@ -510,6 +510,6 @@ FROM ,iter ,logid ,tag - ,module + ,comment ) SELECT json_agg(row_to_json(insagg)) x from insagg \ No newline at end of file diff --git a/route_sql/build/build_fcpool.sql b/route_sql/build/build_fcpool.sql index 2071883..243edf3 100644 --- a/route_sql/build/build_fcpool.sql +++ b/route_sql/build/build_fcpool.sql @@ -1,4 +1,9 @@ +BEGIN; + DROP TABLE IF EXISTS rlarp.osm_pool; +DROP TABLE IF EXISTS rlarp.osm_log; + +CREATE TABLE IF NOT EXISTS rlarp.osm_log(id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, doc jsonb); CREATE TABLE IF NOT EXISTS rlarp.osm_pool AS ( WITH @@ -102,7 +107,7 @@ SELECT ,iter ,null::int logid ,''::text tag - ,''::text module + ,''::text "comment" FROM rlarp.osmf_dev o LEFT OUTER JOIN lgdat.cust bc ON @@ -133,9 +138,7 @@ FROM CREATE INDEX osm_qr ON rlarp.osm_pool(quota_rep_descr); ALTER TABLE rlarp.osm_pool ADD CONSTRAINT logfk FOREIGN KEY (logid) REFERENCES rlarp.osm_log(id); -DROP TABLE IF EXISTS rlarp.osm_log; - -CREATE TABLE IF NOT EXISTS rlarp.osm_log(id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, doc jsonb); - GRANT ALL ON TABLE rlarp.osm_log TO api; -GRANT ALL ON TABLE rlarp.osm_pool TO api; \ No newline at end of file +GRANT ALL ON TABLE rlarp.osm_pool TO api; + +COMMIT; \ No newline at end of file diff --git a/route_sql/get_pool.sql b/route_sql/get_pool.sql index 6cc4c81..24e9004 100644 --- a/route_sql/get_pool.sql +++ b/route_sql/get_pool.sql @@ -39,7 +39,7 @@ SELECT ,iter ,logid ,tag - ,module + ,comment FROM rlarp.osm_pool WHERE @@ -78,7 +78,7 @@ GROUP BY ,iter ,logid ,tag - ,module + ,comment ) SELECT json_agg(row_to_json(rows)) x diff --git a/route_sql/new_basket.sql b/route_sql/new_basket.sql index 71f55da..cd52d18 100644 --- a/route_sql/new_basket.sql +++ b/route_sql/new_basket.sql @@ -333,7 +333,7 @@ SELECT ,'replace_source'||' volume' iter ,log.id ,COALESCE(log.doc->>'tag','') "tag" - ,log.doc->>'type' module + ,log.doc->>'message' "comment" FROM basemix b CROSS JOIN log @@ -454,7 +454,7 @@ FROM ,iter ,logid ,tag - ,module + ,comment --------values------------------------- ,sum(value_loc) value_loc ,sum(value_usd) value_usd @@ -497,6 +497,6 @@ FROM ,iter ,logid ,tag - ,module + ,comment ) SELECT json_agg(row_to_json(insagg)) x from insagg \ No newline at end of file diff --git a/route_sql/scale_pd.sql b/route_sql/scale_pd.sql index 36f2606..a835d58 100644 --- a/route_sql/scale_pd.sql +++ b/route_sql/scale_pd.sql @@ -168,7 +168,7 @@ target AS (select target_increment incr) ,'replace_source'||' price' iter ,log.id ,COALESCE(log.doc->>'tag','') "tag" - ,log.doc->>'type' module + ,log.doc->>'message' "comment" FROM basemix b CROSS JOIN scale s @@ -215,7 +215,7 @@ target AS (select target_increment incr) ,iter ,logid ,tag - ,module + ,comment --------values------------------------- ,sum(value_loc) value_loc ,sum(value_usd) value_usd @@ -258,6 +258,6 @@ target AS (select target_increment incr) ,iter ,logid ,tag - ,module + ,comment ) SELECT json_agg(row_to_json(insagg)) x from insagg diff --git a/route_sql/scale_vd.sql b/route_sql/scale_vd.sql index c53b9cc..866006a 100644 --- a/route_sql/scale_vd.sql +++ b/route_sql/scale_vd.sql @@ -197,7 +197,7 @@ target AS (select incr_qty qincr) ,'replace_source'||' volume' iter ,log.id ,COALESCE(log.doc->>'tag','') "tag" - ,log.doc->>'type' module + ,log.doc->>'message' "comment" FROM basemix b CROSS JOIN scale s @@ -242,7 +242,7 @@ FROM ,iter ,logid ,tag - ,module + ,comment --------values------------------------- ,sum(value_loc) value_loc ,sum(value_usd) value_usd @@ -285,6 +285,6 @@ FROM ,iter ,logid ,tag - ,module + ,comment ) SELECT json_agg(row_to_json(insagg)) x from insagg \ No newline at end of file diff --git a/route_sql/scale_vupd.sql b/route_sql/scale_vupd.sql index c72741a..5e95d83 100644 --- a/route_sql/scale_vupd.sql +++ b/route_sql/scale_vupd.sql @@ -196,7 +196,7 @@ target AS (select target_vol vincr, target_prc pincr) ,'replace_source'||' volume' iter ,log.id ,COALESCE(log.doc->>'tag','') "tag" - ,log.doc->>'type' module + ,log.doc->>'message' "comment" FROM basemix b CROSS JOIN vscale s @@ -275,7 +275,7 @@ FROM ,'replace_source'||' price' iter ,log.id ,COALESCE(log.doc->>'tag','') "tag" - ,log.doc->>'type' module + ,log.doc->>'message' "comment" FROM volume b CROSS JOIN pscale s @@ -322,7 +322,7 @@ FROM ,iter ,logid ,tag - ,module + ,comment --------values------------------------- ,sum(value_loc) value_loc ,sum(value_usd) value_usd @@ -365,6 +365,6 @@ FROM ,iter ,logid ,tag - ,module + ,comment ) SELECT json_agg(row_to_json(insagg)) x from insagg