Merge branch 'feature/tags' of hc-companies/forecast_api into dev
This commit is contained in:
commit
55257733b2
@ -332,8 +332,9 @@ SELECT
|
|||||||
,'replace_version' "version"
|
,'replace_version' "version"
|
||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'message','') "comment"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
|
,log.doc->>'module' module
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN vscale s
|
CROSS JOIN vscale s
|
||||||
@ -418,10 +419,11 @@ SELECT
|
|||||||
,b.ship_month
|
,b.ship_month
|
||||||
,b.ship_season
|
,b.ship_season
|
||||||
,'replace_version' "version"
|
,'replace_version' "version"
|
||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' price' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'message','') "comment"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
|
,log.doc->>'module' module
|
||||||
FROM
|
FROM
|
||||||
volume b
|
volume b
|
||||||
CROSS JOIN pscale p
|
CROSS JOIN pscale p
|
||||||
@ -466,8 +468,8 @@ FROM
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -509,7 +511,7 @@ FROM
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT json_agg(row_to_json(insagg)) x from insagg
|
@ -1,4 +1,9 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS rlarp.osm_pool;
|
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 (
|
CREATE TABLE IF NOT EXISTS rlarp.osm_pool AS (
|
||||||
WITH
|
WITH
|
||||||
@ -101,6 +106,7 @@ SELECT
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,null::int logid
|
,null::int logid
|
||||||
|
,''::text tag
|
||||||
,''::text "comment"
|
,''::text "comment"
|
||||||
,''::text module
|
,''::text module
|
||||||
FROM
|
FROM
|
||||||
@ -133,9 +139,7 @@ FROM
|
|||||||
CREATE INDEX osm_qr ON rlarp.osm_pool(quota_rep_descr);
|
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);
|
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_log TO api;
|
||||||
GRANT ALL ON TABLE rlarp.osm_pool TO api;
|
GRANT ALL ON TABLE rlarp.osm_pool TO api;
|
||||||
|
|
||||||
|
COMMIT;
|
@ -38,8 +38,8 @@ SELECT
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
FROM
|
FROM
|
||||||
rlarp.osm_pool
|
rlarp.osm_pool
|
||||||
WHERE
|
WHERE
|
||||||
@ -77,8 +77,8 @@ GROUP BY
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
json_agg(row_to_json(rows)) x
|
json_agg(row_to_json(rows)) x
|
||||||
|
@ -4,6 +4,7 @@ SELECT
|
|||||||
l.doc->>'user' "user",
|
l.doc->>'user' "user",
|
||||||
jsonb_path_query_first(l.doc,'$.scenario.quota_rep_descr')->>0 quota_rep_descr,
|
jsonb_path_query_first(l.doc,'$.scenario.quota_rep_descr')->>0 quota_rep_descr,
|
||||||
to_char((l.doc->>'stamp')::timestamptz,'YYYY-MM-DD HH:MI:SS') "stamp",
|
to_char((l.doc->>'stamp')::timestamptz,'YYYY-MM-DD HH:MI:SS') "stamp",
|
||||||
|
l.doc->>'tag' "tag",
|
||||||
l.doc->>'message' "comment",
|
l.doc->>'message' "comment",
|
||||||
jsonb_pretty(l.doc) def,
|
jsonb_pretty(l.doc) def,
|
||||||
l.id
|
l.id
|
||||||
@ -17,6 +18,7 @@ SELECT
|
|||||||
list.user
|
list.user
|
||||||
,list.quota_rep_descr
|
,list.quota_rep_descr
|
||||||
,list.stamp
|
,list.stamp
|
||||||
|
,list.tag
|
||||||
,list.comment
|
,list.comment
|
||||||
,list.def
|
,list.def
|
||||||
,list.id
|
,list.id
|
||||||
@ -29,6 +31,7 @@ group BY
|
|||||||
list.user
|
list.user
|
||||||
,list.quota_rep_descr
|
,list.quota_rep_descr
|
||||||
,list.stamp
|
,list.stamp
|
||||||
|
,list.tag
|
||||||
,list.comment
|
,list.comment
|
||||||
,list.def
|
,list.def
|
||||||
,list.id
|
,list.id
|
||||||
|
@ -332,8 +332,9 @@ SELECT
|
|||||||
,'replace_version' "version"
|
,'replace_version' "version"
|
||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'message','') "comment"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
|
,log.doc->>'module' module
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN log
|
CROSS JOIN log
|
||||||
@ -453,8 +454,8 @@ FROM
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -496,7 +497,7 @@ FROM
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT json_agg(row_to_json(insagg)) x from insagg
|
@ -167,8 +167,9 @@ target AS (select target_increment incr)
|
|||||||
,'replace_version' "version"
|
,'replace_version' "version"
|
||||||
,'replace_source'||' price' iter
|
,'replace_source'||' price' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'message','') "comment"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
|
,log.doc->>'module' module
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN scale s
|
CROSS JOIN scale s
|
||||||
@ -214,8 +215,8 @@ target AS (select target_increment incr)
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -257,7 +258,7 @@ target AS (select target_increment incr)
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||||
|
@ -196,8 +196,9 @@ target AS (select incr_qty qincr)
|
|||||||
,'replace_version' "version"
|
,'replace_version' "version"
|
||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'message','') "comment"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
|
,log.doc->>'module' module
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN scale s
|
CROSS JOIN scale s
|
||||||
@ -241,8 +242,8 @@ FROM
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -284,7 +285,7 @@ FROM
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT json_agg(row_to_json(insagg)) x from insagg
|
@ -195,8 +195,9 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,'replace_version' "version"
|
,'replace_version' "version"
|
||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'message','') "comment"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
|
,log.doc->>'module' module
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN vscale s
|
CROSS JOIN vscale s
|
||||||
@ -274,8 +275,9 @@ FROM
|
|||||||
,'replace_version' "version"
|
,'replace_version' "version"
|
||||||
,'replace_source'||' price' iter
|
,'replace_source'||' price' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'message','') "comment"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
|
,log.doc->>'module' module
|
||||||
FROM
|
FROM
|
||||||
volume b
|
volume b
|
||||||
CROSS JOIN pscale s
|
CROSS JOIN pscale s
|
||||||
@ -321,8 +323,8 @@ FROM
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -364,7 +366,7 @@ FROM
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
|
,tag
|
||||||
,comment
|
,comment
|
||||||
,module
|
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||||
|
Loading…
Reference in New Issue
Block a user