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

fix re_building_group_disposal missing fk_columns #49

Merged
merged 9 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
3 changes: 2 additions & 1 deletion datamodel/.docker/init_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ recreate_db(){
psql -U postgres -d postgres -o /dev/null -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '$1'"
dropdb -U postgres --if-exists $1
createdb -U postgres $1
psql -c "CREATE EXTENSION postgis"
psql -c "CREATE EXTENSION IF NOT EXISTS postgis"
psql -c "CREATE EXTENSION IF NOT EXISTS uuid-ossp"
}

if [ "$1" == "wait" ]; then
Expand Down
40 changes: 22 additions & 18 deletions datamodel/changelogs/0001/03_tww_db_dss.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
------ This file generates the VSA-DSS database (Modul VSA-DSS (2020)) in en on QQIS
------ For questions etc. please contact Stefan Burckhardt [email protected]
------ version 21.11.2023 17:42:42
------ version 11.12.2023 15:52:18
------ with 3D coordinates

---------------------------
Expand Down Expand Up @@ -28,27 +28,27 @@ WITH (
-------
CREATE TABLE tww_od.re_building_group_disposal
(
obj_id varchar(16) NOT NULL,
CONSTRAINT pkey_tww_od_re_building_group_disposal_obj_id PRIMARY KEY (obj_id)
)
WITH (
OIDS = False
id uuid NOT NULL DEFAULT uuid_generate_v4(),
CONSTRAINT pkey_tww_od_re_building_group_disposal_id PRIMARY KEY (id)



);
CREATE SEQUENCE tww_od.seq_re_building_group_disposal_oid INCREMENT 1 MINVALUE 0 MAXVALUE 999999 START 0;
ALTER TABLE tww_od.re_building_group_disposal ALTER COLUMN obj_id SET DEFAULT tww_sys.generate_oid('tww_od','re_building_group_disposal');
COMMENT ON COLUMN tww_od.re_building_group_disposal.obj_id IS 'INTERLIS STANDARD OID (with Postfix/Präfix), see www.interlis.ch';


COMMENT ON COLUMN tww_od.re_building_group_disposal.id IS 'UUID generated with uuid_generate_v4 see https://www.postgresql.org/docs/16/uuid-ossp.html#UUID-OSSP-FUNCTIONS-SECT';
-------
CREATE TABLE tww_od.re_maintenance_event_wastewater_structure
(
obj_id varchar(16) NOT NULL,
CONSTRAINT pkey_tww_od_re_maintenance_event_wastewater_structure_obj_id PRIMARY KEY (obj_id)
)
WITH (
OIDS = False
id uuid NOT NULL DEFAULT uuid_generate_v4(),
CONSTRAINT pkey_tww_od_re_maintenance_event_wastewater_structure_id PRIMARY KEY (id)



);
CREATE SEQUENCE tww_od.seq_re_maintenance_event_wastewater_structure_oid INCREMENT 1 MINVALUE 0 MAXVALUE 999999 START 0;
ALTER TABLE tww_od.re_maintenance_event_wastewater_structure ALTER COLUMN obj_id SET DEFAULT tww_sys.generate_oid('tww_od','re_maintenance_event_wastewater_structure');
COMMENT ON COLUMN tww_od.re_maintenance_event_wastewater_structure.obj_id IS 'INTERLIS STANDARD OID (with Postfix/Präfix), see www.interlis.ch';


COMMENT ON COLUMN tww_od.re_maintenance_event_wastewater_structure.id IS 'UUID generated with uuid_generate_v4 see https://www.postgresql.org/docs/16/uuid-ossp.html#UUID-OSSP-FUNCTIONS-SECT';
-------
CREATE TABLE tww_od.txt_symbol
(
Expand Down Expand Up @@ -1176,7 +1176,7 @@ COMMENT ON COLUMN tww_od.reach.clear_height IS 'Clear height (inside) of profile
ALTER TABLE tww_od.reach ADD COLUMN coefficient_of_friction smallint ;
COMMENT ON COLUMN tww_od.reach.coefficient_of_friction IS 'yyy http://www.linguee.com/english-german/search?source=auto&query=reibungsbeiwert / Hydraulische Kenngrösse zur Beschreibung der Beschaffenheit der Kanalwandung. Beiwert für die Formeln nach Manning-Strickler (K oder kstr) / Constante de rugosité selon Manning-Strickler (K ou kstr)';
ALTER TABLE tww_od.reach ADD COLUMN elevation_determination integer ;
COMMENT ON COLUMN tww_od.reach.elevation_determination IS 'Defines the elevation_determination of the reach. / Definiert die Hoehenbestimmung einer Haltung. / Définition de la détermination altimétrique d''un tronçon.';
COMMENT ON COLUMN tww_od.reach.elevation_determination IS 'Defines the elevation_determination of the reach (progression3D). / Definiert die Hoehenbestimmung einer Haltung (Verlauf3D). / Définition de la détermination altimétrique d''un tronçon (TRACE3D).';
ALTER TABLE tww_od.reach ADD COLUMN flow_time_dry_weather decimal(7,0) ;
COMMENT ON COLUMN tww_od.reach.flow_time_dry_weather IS 'Flow time in dry weather (daily mean) / Fliesszeit bei Trockenwetter (Tagesmittel) / Temps d''écoulement par temps sec (moyenne journalière)';
ALTER TABLE tww_od.reach ADD COLUMN horizontal_positioning integer ;
Expand Down Expand Up @@ -2979,6 +2979,10 @@ FOR EACH ROW EXECUTE PROCEDURE

-------
------------ Relationships and Value Tables ----------- ;
ALTER TABLE tww_od.re_building_group_disposal ADD COLUMN fk_building_group varchar(16);
ALTER TABLE tww_od.re_building_group_disposal ADD CONSTRAINT rel_building_group_disposal_building_group FOREIGN KEY (fk_building_group) REFERENCES tww_od.building_group(obj_id) ON UPDATE CASCADE ON DELETE cascade;
ALTER TABLE tww_od.re_building_group_disposal ADD COLUMN fk_disposal varchar(16);
ALTER TABLE tww_od.re_building_group_disposal ADD CONSTRAINT rel_building_group_disposal_disposal FOREIGN KEY (fk_disposal) REFERENCES tww_od.disposal(obj_id) ON UPDATE CASCADE ON DELETE cascade;
ALTER TABLE tww_od.re_maintenance_event_wastewater_structure ADD COLUMN fk_wastewater_structure varchar(16);
ALTER TABLE tww_od.re_maintenance_event_wastewater_structure ADD CONSTRAINT rel_maintenance_event_wastewater_structure_wastewater_structure FOREIGN KEY (fk_wastewater_structure) REFERENCES tww_od.wastewater_structure(obj_id) ON UPDATE CASCADE ON DELETE cascade;
ALTER TABLE tww_od.re_maintenance_event_wastewater_structure ADD COLUMN fk_maintenance_event varchar(16);
Expand Down
Loading
Loading