change module to be the comment
This commit is contained in:
parent
d3a4a45d53
commit
69346646bd
@ -333,7 +333,7 @@ SELECT
|
|||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'tag','') "tag"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN vscale s
|
CROSS JOIN vscale s
|
||||||
@ -421,7 +421,7 @@ SELECT
|
|||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'tag','') "tag"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
FROM
|
FROM
|
||||||
volume b
|
volume b
|
||||||
CROSS JOIN pscale p
|
CROSS JOIN pscale p
|
||||||
@ -467,7 +467,7 @@ FROM
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -510,6 +510,6 @@ FROM
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
)
|
)
|
||||||
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
|
||||||
@ -102,7 +107,7 @@ SELECT
|
|||||||
,iter
|
,iter
|
||||||
,null::int logid
|
,null::int logid
|
||||||
,''::text tag
|
,''::text tag
|
||||||
,''::text module
|
,''::text "comment"
|
||||||
FROM
|
FROM
|
||||||
rlarp.osmf_dev o
|
rlarp.osmf_dev o
|
||||||
LEFT OUTER JOIN lgdat.cust bc ON
|
LEFT OUTER JOIN lgdat.cust bc ON
|
||||||
@ -133,9 +138,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;
|
@ -39,7 +39,7 @@ SELECT
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
FROM
|
FROM
|
||||||
rlarp.osm_pool
|
rlarp.osm_pool
|
||||||
WHERE
|
WHERE
|
||||||
@ -78,7 +78,7 @@ GROUP BY
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
json_agg(row_to_json(rows)) x
|
json_agg(row_to_json(rows)) x
|
||||||
|
@ -333,7 +333,7 @@ SELECT
|
|||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'tag','') "tag"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN log
|
CROSS JOIN log
|
||||||
@ -454,7 +454,7 @@ FROM
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -497,6 +497,6 @@ FROM
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT json_agg(row_to_json(insagg)) x from insagg
|
@ -168,7 +168,7 @@ target AS (select target_increment incr)
|
|||||||
,'replace_source'||' price' iter
|
,'replace_source'||' price' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'tag','') "tag"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN scale s
|
CROSS JOIN scale s
|
||||||
@ -215,7 +215,7 @@ target AS (select target_increment incr)
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -258,6 +258,6 @@ target AS (select target_increment incr)
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||||
|
@ -197,7 +197,7 @@ target AS (select incr_qty qincr)
|
|||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'tag','') "tag"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN scale s
|
CROSS JOIN scale s
|
||||||
@ -242,7 +242,7 @@ FROM
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -285,6 +285,6 @@ FROM
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT json_agg(row_to_json(insagg)) x from insagg
|
@ -196,7 +196,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,'replace_source'||' volume' iter
|
,'replace_source'||' volume' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'tag','') "tag"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
FROM
|
FROM
|
||||||
basemix b
|
basemix b
|
||||||
CROSS JOIN vscale s
|
CROSS JOIN vscale s
|
||||||
@ -275,7 +275,7 @@ FROM
|
|||||||
,'replace_source'||' price' iter
|
,'replace_source'||' price' iter
|
||||||
,log.id
|
,log.id
|
||||||
,COALESCE(log.doc->>'tag','') "tag"
|
,COALESCE(log.doc->>'tag','') "tag"
|
||||||
,log.doc->>'type' module
|
,log.doc->>'message' "comment"
|
||||||
FROM
|
FROM
|
||||||
volume b
|
volume b
|
||||||
CROSS JOIN pscale s
|
CROSS JOIN pscale s
|
||||||
@ -322,7 +322,7 @@ FROM
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
--------values-------------------------
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
@ -365,6 +365,6 @@ FROM
|
|||||||
,iter
|
,iter
|
||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,module
|
,comment
|
||||||
)
|
)
|
||||||
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