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 order_usage_current #212

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Changes from all commits
Commits
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
25 changes: 21 additions & 4 deletions datamodel/changelogs/0001/05_data_model_extensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ added solely for TEKSI Wastewater & GEP';

-- this column is an extension to the VSA data model and puts the _function_hierarchic in order
ALTER TABLE tww_vl.channel_function_hierarchic ADD COLUMN order_fct_hierarchic smallint;
-- integrate and adapt Alter order_fct_hierarchic in tww_vl.channel_function_hierarchic #224
-- https://github.com/QGEP/datamodel/pull/224 //skip-keyword-check
-- this column is an extension to the VSA data model and puts the _usage_current in order
ALTER TABLE tww_vl.channel_usage_current ADD COLUMN order_usage_current smallint;
UPDATE tww_vl.channel_function_hierarchic
SET order_fct_hierarchic=
array_position(
Expand All @@ -53,6 +49,27 @@ SET order_fct_hierarchic=
]
,code);

-- integrate and adapt Alter order_fct_hierarchic in tww_vl.channel_function_hierarchic #224
-- https://github.com/QGEP/datamodel/pull/224 //skip-keyword-check
-- this column is an extension to the VSA data model and puts the _usage_current in order
ALTER TABLE tww_vl.channel_usage_current ADD COLUMN order_usage_current smallint;

UPDATE tww_vl.channel_usage_current
SET order_usage_current=
array_position(
ARRAY[
4526 --wastewater
,4522 --combined_wastewater
,4516 --discharged_combined_wastewater
,4524 --clean_wastewater
,4514 --clean_wastewater
,9023 --surface_water
,4518 --creek_water
,4571 --other
,5322 --unknown
]
,code);

-- this column is an extension to the VSA data model and facilitates filtering out primary features
ALTER TABLE tww_vl.channel_function_hierarchic ADD COLUMN tww_is_primary bool DEFAULT FALSE;
UPDATE tww_vl.channel_function_hierarchic
Expand Down