diff backend/doc/schema/oracle-sinfo-uinfo.sql @ 9032:1f63e9d3b0ec

New columns for bed_height, tkh and depth_evolution, a few syntactic corrections for Oracle
author mschaefer
date Fri, 27 Apr 2018 17:35:12 +0200
parents ce99d3db9477
children 4c5eeaff554c
line wrap: on
line diff
--- a/backend/doc/schema/oracle-sinfo-uinfo.sql	Fri Apr 27 11:34:04 2018 +0200
+++ b/backend/doc/schema/oracle-sinfo-uinfo.sql	Fri Apr 27 17:35:12 2018 +0200
@@ -3,26 +3,50 @@
 
 --Add new column wsts.sinfo_selection
 
-ALTER TABLE wsts ADD COLUMN sinfo_selection CHAR(1) CHECK((sinfo_selection IS NULL) OR (sinfo_selection IN ('W','Q')));
+ALTER TABLE wsts ADD (
+  sinfo_selection CHAR(1) CHECK((sinfo_selection IS NULL) OR (sinfo_selection IN ('W','Q')))
+);
 COMMENT ON COLUMN wsts.sinfo_selection IS 'Whether and how the WST series is selected within S-INFO calculation types ("W"=without-Q-group, "Q"=with-Q-group, NULL=not-selectable)' ;
 
 
 --Add new columns bed_height.sounding_width_info and bed_height.comment
 
-ALTER TABLE bed_height ADD COLUMN sounding_width_info VARCHAR2(256);
+ALTER TABLE bed_height ADD (
+  sounding_width_info VARCHAR2(256),
+  "comment" VARCHAR2(256)
+);
 COMMENT ON COLUMN bed_height.sounding_width_info IS 'File header line info "ausgewertete Peilbreite"' ;
-
-ALTER TABLE bed_height ADD COLUMN "comment" VARCHAR2(256);
 COMMENT ON COLUMN bed_height."comment" IS 'File header line info "weitere Bemerkungen"' ;
 
 
 --Add new columns bed_height_values.min_height (Talweg) and bed_height_values.max_height (Kammlage) (same type as existing height column)
 
-ALTER TABLE bed_height_values ADD COLUMN min_height DOUBLE PRECISION;
+ALTER TABLE bed_height_values ADD (
+  min_height FLOAT(126),
+  max_height FLOAT(126),
+  height01 FLOAT(32),
+  height02 FLOAT(32),
+  height03 FLOAT(32),
+  height04 FLOAT(32),
+  height05 FLOAT(32),
+  height06 FLOAT(32),
+  height07 FLOAT(32),
+  height08 FLOAT(32),
+  height09 FLOAT(32),
+  height10 FLOAT(32)
+);
 COMMENT ON COLUMN bed_height_values.min_height IS 'Minimum bed height (Talweg) in m' ;
-
-ALTER TABLE bed_height_values ADD COLUMN max_height DOUBLE PRECISION;
 COMMENT ON COLUMN bed_height_values.max_height IS 'Maximum bed height (Kammlage) in m' ;
+COMMENT ON COLUMN bed_height_values.height01 IS 'Bed height of section 1 in m' ;
+COMMENT ON COLUMN bed_height_values.height02 IS 'Bed height of section 2 in m' ;
+COMMENT ON COLUMN bed_height_values.height03 IS 'Bed height of section 3 in m' ;
+COMMENT ON COLUMN bed_height_values.height04 IS 'Bed height of section 4 in m' ;
+COMMENT ON COLUMN bed_height_values.height05 IS 'Bed height of section 5 in m' ;
+COMMENT ON COLUMN bed_height_values.height06 IS 'Bed height of section 6 in m' ;
+COMMENT ON COLUMN bed_height_values.height07 IS 'Bed height of section 7 in m' ;
+COMMENT ON COLUMN bed_height_values.height08 IS 'Bed height of section 8 in m' ;
+COMMENT ON COLUMN bed_height_values.height09 IS 'Bed height of section 9 in m' ;
+COMMENT ON COLUMN bed_height_values.height10 IS 'Bed height of section 10 in m' ;
 
 
 --Bed mobility
@@ -81,9 +105,9 @@
 
 CREATE TABLE infrastructure_values (
     id  NUMBER(9,0) PRIMARY KEY,
-    infrastructure_id  NUMBER(9,0) CONSTRAINT cInfrastructureValuesInfrastructure REFERENCES infrastructure(id) ON DELETE CASCADE,
+    infrastructure_id  NUMBER(9,0) CONSTRAINT cInfrastructureValuesInfrastru REFERENCES infrastructure(id) ON DELETE CASCADE,
     station  NUMBER(7,3) NOT NULL,
-    attribute_id  NUMBER(38,0) CONSTRAINT cInfrastructureValuesAttributes REFERENCES attributes(id),
+    attribute_id  NUMBER(38,0) CONSTRAINT cInfrastructureValuesAttrib REFERENCES attributes(id),
     height  NUMBER(6,2)
 );
 COMMENT ON TABLE infrastructure_values IS 'Infrastructure at a river station' ;
@@ -185,14 +209,16 @@
     day  DATE,
     kmrange_info  VARCHAR2(32),
     filename  VARCHAR2(256) NOT NULL,
+    groupname  VARCHAR2(32) NOT NULL CHECK(groupname IN ('messung','berechnung')),
     sounding_info  VARCHAR2(64),
     evaluation_by  VARCHAR2(256),
     "comment"  VARCHAR2(256)
 );
-COMMENT ON TABLE tkh IS 'Longitudinal section of computed Transportkörperhöhe of a river' ;
+COMMENT ON TABLE tkh IS 'Longitudinal section of computed Transportkoerperhoehe of a river' ;
 COMMENT ON COLUMN tkh.day IS 'File header line info "Datum"' ;
 COMMENT ON COLUMN tkh.kmrange_info IS 'File header line info "Strecke"' ;
 COMMENT ON COLUMN tkh.filename IS 'Name without type extension of the imported file' ;
+COMMENT ON COLUMN tkh.groupname IS 'Group the file belongs to' ;
 COMMENT ON COLUMN tkh.sounding_info IS 'File header line info "Peilung"' ;
 COMMENT ON COLUMN tkh.evaluation_by IS 'File header line info "Auswerter"' ;
 COMMENT ON COLUMN tkh."comment" IS 'File header line info "weitere Bemerkungen"' ;
@@ -205,7 +231,7 @@
     tkh_id  NUMBER(9,0) NOT NULL CONSTRAINT cTkhColumnTkh REFERENCES tkh(id) ON DELETE CASCADE,
     name  VARCHAR2(64) NOT NULL
 );
-COMMENT ON TABLE tkh_column IS 'Longitudinal section of computed Transportkörperhöhe for a waterlevel series' ;
+COMMENT ON TABLE tkh_column IS 'Longitudinal section of computed Transportkoerperhoehe for a waterlevel series' ;
 COMMENT ON COLUMN tkh_column.name IS 'Name of the tkh computation column' ;
 
 CREATE SEQUENCE TKH_COLUMN_ID_SEQ ;
@@ -217,9 +243,9 @@
     station  NUMBER(7,3) NOT NULL,
     tkheight  NUMBER(7,3)
 );
-COMMENT ON TABLE tkh_values IS 'Transportkörperhöhe of a river station and referenced file column' ;
+COMMENT ON TABLE tkh_values IS 'Transportkoerperhoehe of a river station and referenced file column' ;
 COMMENT ON COLUMN tkh_values.station IS 'River km' ;
-COMMENT ON COLUMN tkh_values.tkheight IS 'Transportkörperhöhe of a river station computed for a waterlevel in  m' ;
+COMMENT ON COLUMN tkh_values.tkheight IS 'Transportkoerperhoehe of a river station computed for a waterlevel in  m' ;
 
 CREATE SEQUENCE TKH_VALUES_ID_SEQ ;
 
@@ -262,7 +288,7 @@
 
 CREATE TABLE flow_depth_values (
     id  NUMBER(9,0) PRIMARY KEY,
-    flow_depth_column_id  NUMBER(9,0) NOT NULL CONSTRAINT cFlowDepthValuesFlowDepthColumn REFERENCES flow_depth_column(id) ON DELETE CASCADE,
+    flow_depth_column_id  NUMBER(9,0) NOT NULL CONSTRAINT cFlowDepthValuesFlowDepthCol REFERENCES flow_depth_column(id) ON DELETE CASCADE,
     station  NUMBER(7,3) NOT NULL,
     depth  NUMBER(7,3)
 );
@@ -287,6 +313,7 @@
     curr_glw  VARCHAR2(64) NOT NULL,
     old_glw  VARCHAR2(64) NOT NULL,
     filename  VARCHAR2(256) NOT NULL,
+    groupname  VARCHAR2(32) NOT NULL CHECK(groupname IN ('aktuell','etappe')),
     "comment"  VARCHAR2(256)
 );
 COMMENT ON TABLE depth_evolution IS 'Longitudinal section of the evolution of the flow depth of a river' ;
@@ -298,6 +325,7 @@
 COMMENT ON COLUMN depth_evolution.curr_glw IS 'File header line info "Aktuelle Wasserspiegellage"' ;
 COMMENT ON COLUMN depth_evolution.old_glw IS 'File header line info "Historische Wasserspiegellage"' ;
 COMMENT ON COLUMN depth_evolution.filename IS 'Name without type extension of the imported file' ;
+COMMENT ON COLUMN depth_evolution.groupname IS 'Group the file belongs to' ;
 COMMENT ON COLUMN depth_evolution."comment" IS 'File header line info "weitere Bemerkungen"' ;
 
 CREATE SEQUENCE DEPTH_EVOLUTION_ID_SEQ ;
@@ -305,7 +333,7 @@
 
 CREATE TABLE depth_evolution_values (
     id  NUMBER(9,0) PRIMARY KEY,
-    depth_evolution_id  NUMBER(9,0) NOT NULL CONSTRAINT cDepthEvolutionValuesDepthEvolution REFERENCES depth_evolution(id) ON DELETE CASCADE,
+    depth_evolution_id  NUMBER(9,0) NOT NULL CONSTRAINT cDepthEvolutionValuesDepthEvol REFERENCES depth_evolution(id) ON DELETE CASCADE,
     station  NUMBER(7,3) NOT NULL,
     total_change  NUMBER(8,4),
     change_per_year  NUMBER(8,4)
@@ -334,7 +362,7 @@
 
 CREATE TABLE daily_discharge_values (
     id  NUMBER(9,0) PRIMARY KEY,
-    daily_discharge_id  NUMBER(9,0) NOT NULL CONSTRAINT cDailyDischargeValueDailyDischarge REFERENCES daily_discharge(id) ON DELETE CASCADE,
+    daily_discharge_id  NUMBER(9,0) NOT NULL CONSTRAINT cDailyDischargeValueDailyDisch REFERENCES daily_discharge(id) ON DELETE CASCADE,
     day  DATE NOT NULL,
     discharge  NUMBER(8,3) NOT NULL
 );

http://dive4elements.wald.intevation.org