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

2025-02-04-add-trench_type_etc_to_pipe_section #84

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
BEGIN;

------- Extra attributes on pipe_section based on discussion in https://github.com/teksi/district_heating/issues/54 for Morges (mg)
------ For questions etc. please contact Stefan Burckhardt [email protected]
------ version 4.2.2025

------- add extra attributes to pipe_section
ALTER TABLE tdh_od.pipe_section ADD COLUMN mg_trench_type integer ;
COMMENT ON COLUMN tdh_od.pipe_section.mg_trench_type IS '';
ALTER TABLE tdh_od.pipe_section ADD COLUMN trench_width smallint ;
COMMENT ON COLUMN tdh_od.pipe_section.trench_width IS '';
ALTER TABLE tdh_od.pipe_section ADD COLUMN mg_signaling_band integer ;
COMMENT ON COLUMN tdh_od.pipe_section.mg_signaling_band IS ' / Les conduites sont marquées par une bande de signalisation de couleur';


------------ Relationships and Value Tables ----------- ;
CREATE TABLE tdh_vl.pipe_section_mg_trench_type () INHERITS (tdh_vl.value_list_base);
ALTER TABLE tdh_vl.pipe_section_mg_trench_type ADD CONSTRAINT pkey_tdh_vl_pipe_section_mg_trench_type_code PRIMARY KEY (code);
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9498,9498,'walkable_channel','begehbarer_Kanal','canal_accessible', '', '', '', '', '', '', '', '', '', '', '', '', 'walkable_channel', 'begehbarer_Kanal', 'canal accessible', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9507,9507,'buried.expansion_pads','erdverlegt.Dehnungspolster','enterre.matelas_de_dilatation', '', '', '', '', '', '', '', '', '', '', '', '', 'buried.expansion_pads', 'erdverlegt.Dehnungspolster', 'enterre.matelas de dilatation', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9506,9506,'buried.normal','erdverlegt.normal','enterre.normale', '', '', '', '', '', '', '', '', '', '', '', '', 'buried.normal', 'erdverlegt.normal', 'enterre.normale', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9502,9502,'overhead_line','Freileitung','conduite_aerienne', '', '', '', '', '', '', '', '', '', '', '', '', 'overhead_line', 'Freileitung', 'conduite aerienne', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9499,9499,'vault','Gewoelbe','voute', 'zzz_Gewoelbe', 'rrr_Gewoelbe', '', '', '', '', '', '', '', '', '', '', 'vault', 'Gewoelbe', 'voute', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9505,9505,'hooded_channel','Haubenkanal','caniveau', '', '', '', '', '', '', '', '', '', '', '', '', 'hooded_channel', 'Haubenkanal', 'caniveau', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9503,9503,'insitu_concrete_channel','Ortsbetonkanal','caniveau_en_beton', '', '', '', '', '', '', '', '', '', '', '', '', 'insitu_concrete_channel', 'Ortsbetonkanal', 'caniveau en béton', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9504,9504,'hydraulic_pressure_pipe','Pressrohr','pousse_tube', '', '', '', '', '', '', '', '', '', '', '', '', 'hydraulic_pressure_pipe', 'Pressrohr', 'pousse tube', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9501,9501,'protection_tube','Schutzrohr','fourreau', 'zzz_Schutzrohr', 'rrr_Schutzrohr', '', '', '', '', '', '', '', '', '', '', 'protection_tube', 'Schutzrohr', 'fourreau', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_trench_type (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9500,9500,'unknown','unbekannt','inconnu', 'sconosciuto', 'necunoscuta', '', '', '', '', '', '', '', '', '', '', 'unknown', 'unbekannt', 'inconnu', '', '', 'true');
ALTER TABLE tdh_od.pipe_section ADD CONSTRAINT fkey_vl_pipe_section_mg_trench_type FOREIGN KEY (mg_trench_type)
REFERENCES tdh_vl.pipe_section_mg_trench_type (code) MATCH SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT;


--- pipe_section_mg_signaling_band
CREATE TABLE tdh_vl.pipe_section_mg_signaling_band () INHERITS (tdh_vl.value_list_base);
ALTER TABLE tdh_vl.pipe_section_mg_signaling_band ADD CONSTRAINT pkey_tdh_vl_pipe_section_mg_signaling_band_code PRIMARY KEY (code);
INSERT INTO tdh_vl.pipe_section_mg_signaling_band (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9494,9494,'with_signaling_band','mit_Warnband','avec_bande', 'zzz_mit_Warnband', 'rrr_mit_Warnband', '', '', '', '', '', '', '', '', '', '', 'with_signaling_band', 'mit_Warnband', 'avec bande', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_signaling_band (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9495,9495,'without_signaling_band','ohne_Warnband','sans_bande', 'zzz_ohne_Warnband', 'rrr_ohne_Warnband', '', '', '', '', '', '', '', '', '', '', 'without_signaling_band', 'ohne_Warnband', 'sans bande', '', '', 'true');
INSERT INTO tdh_vl.pipe_section_mg_signaling_band (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, description_en, description_de, description_fr, description_it, description_ro, display_en, display_de, display_fr, display_it, display_ro, active) VALUES (9497,9497,'unknown','unbekannt','inconnue', 'zzz_unbekannt', 'rrr_unbekannt', '', '', '', '', '', '', '', '', '', '', 'unknown', 'unbekannt', 'inconnue', '', '', 'true');
ALTER TABLE tdh_od.pipe_section ADD CONSTRAINT fkey_vl_pipe_section_mg_signaling_band FOREIGN KEY (mg_signaling_band)
REFERENCES tdh_vl.pipe_section_mg_signaling_band (code) MATCH SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT;

COMMIT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
INSERT INTO tdh_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (8005,9490,'pipe_section','mg_trench_type','mg_trench_type','mg_Trassetyp','mg_Type_de_trace','zzz_mg_Trassetyp','rrr_zzz_mg_Trassetyp','NULL','NULL','NULL','NULL','NULL',ARRAY['Werkinformation']::tdh_od.plantype[],'true','integer',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (8005,9491,'pipe_section','mg_trench_width','mg_trench_width','mg_Trassebreite','mg_Largeur_du_trace','zzz_mg_Trassebreite','rrr_mg_Trassebreite','NULL','NULL','NULL','NULL','NULL',ARRAY['Werkinformation']::tdh_od.plantype[],'true','smallint','[mm]','millimeter [mm]','[mm]','Millimeter [mm]','[mm]','milimètre [mm]','[mm]',' millimetro [mm]','[mm]','rrr_Millimeter [mm]',0,4000);
INSERT INTO tdh_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (8005,9493,'pipe_section','mg_signaling_band','mg_signaling_band','mg_Warnband','mg_bande_de_signalisation','zzz_mg_Warnband','rrr_mg_Warnband','NULL','NULL','Les conduites sont marquées par une bande de signalisation de couleur','NULL','NULL',ARRAY['Werkinformation']::tdh_od.plantype[],'true','integer',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);


INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9498,'pipe_section','mg_trench_type','walkable_channel','walkable_channel',NULL,'begehbarer_Kanal',NULL,'canal_accessible',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9499,'pipe_section','mg_trench_type','vault','vault',NULL,'Gewoelbe',NULL,'voute',NULL,'zzz_Gewoelbe',NULL,'rrr_Gewoelbe',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9500,'pipe_section','mg_trench_type','unknown','unknown',NULL,'unbekannt',NULL,'inconnu',NULL,'sconosciuto',NULL,'necunoscuta',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9501,'pipe_section','mg_trench_type','protection_tube','protection_tube',NULL,'Schutzrohr',NULL,'fourreau',NULL,'zzz_Schutzrohr',NULL,'rrr_Schutzrohr',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9502,'pipe_section','mg_trench_type','overhead_line','overhead_line',NULL,'Freileitung',NULL,'conduite_aerienne',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9503,'pipe_section','mg_trench_type','insitu_concrete_channel','insitu_concrete_channel',NULL,'Ortsbetonkanal',NULL,'caniveau_en_beton',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9504,'pipe_section','mg_trench_type','hydraulic_pressure_pipe','hydraulic_pressure_pipe',NULL,'Pressrohr',NULL,'pousse_tube',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9505,'pipe_section','mg_trench_type','hooded_channel','hooded_channel',NULL,'Haubenkanal',NULL,'caniveau',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9506,'pipe_section','mg_trench_type','buried.normal','buried.normal',NULL,'erdverlegt.normal',NULL,'enterre.normale',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9490,9507,'pipe_section','mg_trench_type','buried.expansion_pads','buried.expansion_pads',NULL,'erdverlegt.Dehnungspolster',NULL,'enterre.matelas_de_dilatation',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9493,9494,'pipe_section','mg_signaling_band','with_signaling_band','with_signaling_band',NULL,'mit_Warnband',NULL,'avec_bande',NULL,'zzz_mit_Warnband',NULL,'rrr_mit_Warnband',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9493,9495,'pipe_section','mg_signaling_band','without_signaling_band','without_signaling_band',NULL,'ohne_Warnband',NULL,'sans_bande',NULL,'zzz_ohne_Warnband',NULL,'rrr_ohne_Warnband',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO tdh_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (8005,9493,9497,'pipe_section','mg_signaling_band','unknown','unknown',NULL,'unbekannt',NULL,'inconnue',NULL,'zzz_unbekannt',NULL,'rrr_unbekannt',NULL,NULL,NULL,NULL,NULL,NULL);
5 changes: 4 additions & 1 deletion datamodel/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/04_tdh_

# psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/05_data_model_extensions.sql

psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/05_tdh_db_pipe_section_extra_attributes.sql

psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/09_tdh_dictionaries.sql -v SRID=$SRID

psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/09_tdh_organisation_dictionaries.sql -v SRID=$SRID

psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/09_tdh_control_cable_dictionaries.sql -v SRID=$SRID


psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/09_tdh_protection_tube_dictionaries.sql -v SRID=$SRID

psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/09_tdh_db_pipe_section_extra_attributes_dictionaries.sql -v SRID=$SRID

#psql "service=${PGSERVICE}" -v ON_ERROR_STOP=1 -f ${DIR}/changelogs/0001/13_import.sql -v SRID=$SRID


Expand Down
Loading