Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set audit sql #249

Merged
merged 21 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion datamodel/app/create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def create_app(
run_sql("DROP SCHEMA IF EXISTS tww_app CASCADE;", pg_service)

run_sql("CREATE SCHEMA tww_app;", pg_service)

run_sql_file("functions/oid_functions.sql", pg_service)
run_sql_file("functions/modification_functions.sql", pg_service)
run_sql_file("functions/symbology_functions.sql", pg_service)
Expand Down
1 change: 1 addition & 0 deletions datamodel/app/functions/organisation_functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ END;
$BODY$
LANGUAGE plpgsql VOLATILE;


-- function for retrieving default obj_id
CREATE OR REPLACE FUNCTION tww_app.get_default_values(field_name text)
RETURNS varchar(16) AS
Expand Down
17 changes: 10 additions & 7 deletions datamodel/app/functions/symbology_functions.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

-----------------------------------------------------------------------
-- Enable or disable Symbology Triggers
-- To temporarily disable these cache refreshes for batch jobs like migrations
Expand Down Expand Up @@ -134,8 +133,6 @@ $BODY$
LANGUAGE plpgsql
VOLATILE;



--------------------------------------------------------
-- UPDATE wastewater node symbology by overflow
-- Argument:
Expand Down Expand Up @@ -261,6 +258,7 @@ BEGIN
END; $BODY$
LANGUAGE plpgsql VOLATILE;


CREATE TRIGGER ws_symbology_update_by_channel
AFTER INSERT OR UPDATE OR DELETE
ON tww_od.channel
Expand Down Expand Up @@ -306,6 +304,7 @@ BEGIN
END; $BODY$
LANGUAGE plpgsql VOLATILE;


-- only update -> insert and delete are handled by reach trigger
CREATE TRIGGER ws_symbology_update_by_reach_point
AFTER UPDATE
Expand Down Expand Up @@ -369,6 +368,7 @@ BEGIN
END; $BODY$
LANGUAGE plpgsql VOLATILE;


CREATE TRIGGER ws_symbology_update_by_reach
AFTER INSERT OR UPDATE OR DELETE
ON tww_od.reach
Expand Down Expand Up @@ -498,7 +498,6 @@ SET _label = label,
_input_label = input_label,
_output_label = output_label
FROM(

SELECT ws_obj_id,
COALESCE(ws_identifier, '') as label,
CASE WHEN count(co_level)<2 THEN array_to_string(array_agg(E'\nC' || '=' || co_level ORDER BY idx DESC), '', '') ELSE
Expand Down Expand Up @@ -581,11 +580,11 @@ LANGUAGE plpgsql
VOLATILE;



--------------------------------------------------
-- ON COVER CHANGE
--------------------------------------------------


CREATE OR REPLACE FUNCTION tww_app.symbology_on_cover_change()
RETURNS trigger AS
$BODY$
Expand Down Expand Up @@ -614,6 +613,7 @@ BEGIN
END; $BODY$
LANGUAGE plpgsql VOLATILE;


CREATE TRIGGER on_cover_change
AFTER INSERT OR UPDATE OR DELETE
ON tww_od.cover
Expand Down Expand Up @@ -650,6 +650,7 @@ BEGIN
END; $BODY$
LANGUAGE plpgsql VOLATILE;


CREATE TRIGGER ws_label_update_by_wastewater_networkelement
AFTER INSERT OR UPDATE OR DELETE
ON tww_od.wastewater_networkelement
Expand All @@ -667,6 +668,7 @@ FOR EACH ROW
-- ON WASTEWATER STRUCTURE CHANGE
--------------------------------------------------


CREATE OR REPLACE FUNCTION tww_app.symbology_on_wastewater_structure_update()
RETURNS trigger AS
$BODY$
Expand Down Expand Up @@ -731,17 +733,18 @@ BEGIN
END; $BODY$
LANGUAGE plpgsql VOLATILE;


CREATE TRIGGER on_reach_2_change
AFTER INSERT OR UPDATE OR DELETE
ON tww_od.reach
FOR EACH ROW
EXECUTE PROCEDURE tww_app.symbology_on_reach_change();


--------------------------------------------------
-- ON WASTEWATER NODE CHANGE
--------------------------------------------------


CREATE OR REPLACE FUNCTION tww_app.symbology_on_wastewater_node_change()
RETURNS trigger AS
$BODY$
Expand Down Expand Up @@ -774,7 +777,6 @@ AFTER INSERT OR UPDATE
ON tww_od.wastewater_node
FOR EACH ROW
EXECUTE PROCEDURE tww_app.symbology_on_wastewater_node_change();

--------------------------------------------------
-- ON REACH POINT CHANGE
--------------------------------------------------
Expand Down Expand Up @@ -834,6 +836,7 @@ FOR EACH ROW
-- CALCULATE REACH LENGTH
--------------------------------------------------


CREATE OR REPLACE FUNCTION tww_app.symbology_calculate_reach_length()
RETURNS trigger AS
$BODY$
Expand Down
Loading