Skip to content

Commit

Permalink
feat(presszone_type): make presszone_type and presszone_head visible …
Browse files Browse the repository at this point in the history
…from vu_views and v_edit_views
  • Loading branch information
mguzman14 committed Aug 12, 2024
1 parent f5ef86a commit 23acd44
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 15 deletions.
23 changes: 13 additions & 10 deletions updates/36/36012/ws/ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ update connec c set brand_id = a.brand, model_id = a.model, cat_valve = a.cat_va
select connec_id, brand, model, cat_valve from man_wjoin
)a where c.connec_id = a.connec_id;

-- man_netwjoin
update node n set brand_id = a.brand, model_id = a.model from (
select node_id, brand, model from man_netwjoin
)a where n.node_id = a.node_id;

-- man_tap
update connec c set cat_valve = a.cat_valve from (
select connec_id, cat_valve from man_tap
)a where c.connec_id = a.connec_id;


-- man_hydrant
update node n set brand_id = a.brand, model_id = a.model from (
select node_id, brand, model from man_hydrant
Expand All @@ -235,11 +246,6 @@ update node n set brand_id = a.brand, model_id = a.model from (
select node_id, brand, model from man_netelement
)a where n.node_id = a.node_id;

-- man_netwjoin
update node n set brand_id = a.brand, model_id = a.model from (
select node_id, brand, model from man_netwjoin
)a where n.node_id = a.node_id;

-- man_pump
update node n set brand_id = a.brand, model_id = a.model from (
select node_id, brand, model from man_pump
Expand All @@ -250,15 +256,12 @@ update node n set brand_id = a.brand, model_id = a.model from (
select node_id, brand, model from man_valve
)a where n.node_id = a.node_id;

-- man_netelement (serial_number)
-- man_netelement
update node n set serial_number = a.serial_number from (
select node_id, serial_number from man_netelement
)a where n.node_id = a.node_id;

-- man_tap
update connec c set cat_valve = a.cat_valve from (
select connec_id, cat_valve from man_tap
)a where c.connec_id = a.connec_id;




Expand Down
25 changes: 21 additions & 4 deletions updates/36/36012/ws/ddlview.sql
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ AS SELECT arc.arc_id,
dma.macrodma_id,
arc.presszone_id,
presszone.name AS presszone_name,
et.idval as presszone_type,
presszone.head as presszone_head,
arc.dqa_id,
dqa.name AS dqa_name,
dqa.macrodqa_id,
Expand Down Expand Up @@ -296,7 +298,8 @@ AS SELECT arc.arc_id,
LEFT JOIN v_ext_streetaxis d ON d.id::text = arc.streetaxis2_id::text
LEFT JOIN arc_add e ON arc.arc_id::text = e.arc_id::text
LEFT JOIN value_state_type vst ON vst.id = arc.state_type
LEFT JOIN ext_municipality mu ON arc.muni_id = mu.muni_id;
LEFT JOIN ext_municipality mu ON arc.muni_id = mu.muni_id
LEFT JOIN edit_typevalue et on et.id = presszone.presszone_type;

CREATE OR REPLACE VIEW v_edit_arc
AS SELECT a.arc_id,
Expand Down Expand Up @@ -332,6 +335,8 @@ AS SELECT a.arc_id,
a.macrodma_id,
a.presszone_id,
a.presszone_name,
a.presszone_type,
a.presszone_head,
a.dqa_id,
a.dqa_name,
a.macrodqa_id,
Expand Down Expand Up @@ -438,6 +443,8 @@ AS SELECT node.node_id,
dma.macrodma_id,
node.presszone_id,
presszone.name AS presszone_name,
et.idval as presszone_type,
presszone.head as presszone_head,
node.staticpressure,
node.dqa_id,
dqa.name AS dqa_name,
Expand Down Expand Up @@ -530,7 +537,8 @@ AS SELECT node.node_id,
LEFT JOIN v_ext_streetaxis b ON b.id::text = node.streetaxis2_id::text
LEFT JOIN node_add e ON e.node_id::text = node.node_id::text
LEFT JOIN value_state_type vst ON vst.id = node.state_type
LEFT JOIN ext_municipality mu ON node.muni_id = mu.muni_id;
LEFT JOIN ext_municipality mu ON node.muni_id = mu.muni_id
LEFT JOIN edit_typevalue et on et.id = presszone.presszone_type;

CREATE OR REPLACE VIEW v_edit_node
AS SELECT n.node_id,
Expand Down Expand Up @@ -562,6 +570,8 @@ AS SELECT n.node_id,
n.macrodma_id,
n.presszone_id,
n.presszone_name,
n.presszone_type,
n.presszone_head,
n.staticpressure,
n.dqa_id,
n.dqa_name,
Expand Down Expand Up @@ -678,6 +688,8 @@ AS SELECT connec.connec_id,
dma.macrodma_id,
connec.presszone_id,
presszone.name AS presszone_name,
et.idval as presszone_type,
presszone.head as presszone_head,
connec.staticpressure,
connec.dqa_id,
dqa.name AS dqa_name,
Expand Down Expand Up @@ -783,7 +795,8 @@ AS SELECT connec.connec_id,
LEFT JOIN v_ext_streetaxis b ON b.id::text = connec.streetaxis2_id::text
LEFT JOIN connec_add e ON e.connec_id::text = connec.connec_id::text
LEFT JOIN value_state_type vst ON vst.id = connec.state_type
LEFT JOIN ext_municipality mu ON connec.muni_id = mu.muni_id;
LEFT JOIN ext_municipality mu ON connec.muni_id = mu.muni_id
LEFT JOIN edit_typevalue et on et.id = presszone.presszone_type;

CREATE OR REPLACE VIEW v_edit_connec
AS WITH s AS (
Expand Down Expand Up @@ -843,9 +856,11 @@ AS WITH s AS (
ELSE a.presszone_name
END AS presszone_name,
CASE
WHEN a.presszone_name IS NULL THEN vu_connec.staticpressure
WHEN a.staticpressure IS NULL THEN vu_connec.staticpressure
ELSE a.staticpressure
END AS staticpressure,
vu_connec.presszone_type,
vu_connec.presszone_head,
CASE
WHEN a.dqa_id IS NULL THEN vu_connec.dqa_id
ELSE a.dqa_id
Expand Down Expand Up @@ -2473,6 +2488,8 @@ AS SELECT v_edit_connec.connec_id,
v_edit_connec.macrodma_id,
v_edit_connec.presszone_id,
v_edit_connec.presszone_name,
v_edit_connec.presszone_type,
v_edit_connec.presszone_head,
v_edit_connec.staticpressure,
v_edit_connec.dqa_id,
v_edit_connec.dqa_name,
Expand Down
5 changes: 4 additions & 1 deletion updates/36/36012/ws/dml.sql
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,7 @@ INSERT INTO archived_rpt_node(
result_id, node_id, elevation, demand, head, press, other, time, quality)
SELECT
result_id, node_id, rpt_elevation, rpt_demand, head, press, other, time, quality
FROM _archived_rpt_node;
FROM _archived_rpt_node;

INSERT INTO sys_foreignkey (typevalue_table, typevalue_name, target_table, target_field, active)
VALUES('edit_typevalue', 'presszone_type', 'presszone', 'presszone_type', true);
11 changes: 11 additions & 0 deletions updates/36/36012/ws/tablect.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
This file is part of Giswater 3
The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This version of Giswater is provided by Giswater Association
*/


SET search_path = SCHEMA_NAME, public, pg_catalog;


ALTER TABLE presszone DROP CONSTRAINT presszone_presszone_type_check;

0 comments on commit 23acd44

Please sign in to comment.