Mercurial > dive4elements > river
annotate backend/doc/schema/postgresql-sinfo-uinfo.sql @ 9011:a44200bf0547
A few directory and file name changes
author | mschaefer |
---|---|
date | Wed, 18 Apr 2018 07:43:04 +0200 |
parents | ce99d3db9477 |
children | 1f63e9d3b0ec |
rev | line source |
---|---|
8968 | 1 BEGIN; |
2 | |
3 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
4 --Add new column wsts.sinfo_selection |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
5 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
6 ALTER TABLE wsts ADD COLUMN sinfo_selection VARCHAR(1) CHECK((sinfo_selection IS NULL) OR (sinfo_selection IN ('W','Q'))); |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
7 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)' ; |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
8 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
9 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
10 --Add new columns bed_height.sounding_width_info and bed_height.comment |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
11 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
12 ALTER TABLE bed_height ADD COLUMN sounding_width_info VARCHAR(256); |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
13 COMMENT ON COLUMN bed_height.sounding_width_info IS 'File header line info "ausgewertete Peilbreite"' ; |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
14 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
15 ALTER TABLE bed_height ADD COLUMN "comment" VARCHAR(256); |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
16 COMMENT ON COLUMN bed_height."comment" IS 'File header line info "weitere Bemerkungen"' ; |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
17 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
18 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
19 --Add new columns bed_height_values.min_height (Talweg) and bed_height_values.max_height (Kammlage) (same type as existing height column) |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
20 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
21 ALTER TABLE bed_height_values ADD COLUMN min_height NUMERIC; |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
22 COMMENT ON COLUMN bed_height_values.min_height IS 'Minimum bed height (Talweg) in m' ; |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
23 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
24 ALTER TABLE bed_height_values ADD COLUMN max_height NUMERIC; |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
25 COMMENT ON COLUMN bed_height_values.max_height IS 'Maximum bed height (Kammlage) in m' ; |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
26 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
27 |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
28 --Bed mobility |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
29 |
8968 | 30 CREATE TABLE bed_mobility ( |
31 id NUMERIC(9,0) PRIMARY KEY, | |
32 river_id integer NOT NULL CONSTRAINT cBedMobilityRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
33 kmrange_info VARCHAR(32), | |
34 filename VARCHAR(256) NOT NULL, | |
35 "comment" VARCHAR(256) | |
36 ); | |
37 COMMENT ON TABLE bed_mobility IS 'Longitudinal section of the bed mobility of a river' ; | |
38 COMMENT ON COLUMN bed_mobility.kmrange_info IS 'File header line info "Strecke"' ; | |
39 COMMENT ON COLUMN bed_mobility.filename IS 'Name without type extension of the imported file' ; | |
40 COMMENT ON COLUMN bed_mobility."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
41 | |
42 CREATE SEQUENCE BED_MOBILITY_ID_SEQ ; | |
43 | |
44 | |
45 CREATE TABLE bed_mobility_values ( | |
46 id NUMERIC(9,0) PRIMARY KEY, | |
47 bed_mobility_id NUMERIC(9,0) NOT NULL CONSTRAINT cBedMobilityValuesBedMobility REFERENCES bed_mobility(id) ON DELETE CASCADE, | |
48 station NUMERIC(7,3) NOT NULL, | |
49 moving NUMERIC(1,0) DEFAULT 0 NOT NULL CHECK(moving IN (0,1)) | |
50 ); | |
51 COMMENT ON TABLE bed_mobility_values IS 'Bed mobility of a km' ; | |
52 COMMENT ON COLUMN bed_mobility_values.station IS 'River km' ; | |
53 COMMENT ON COLUMN bed_mobility_values.moving IS 'Whether the river bed at the station is moving' ; | |
54 | |
55 CREATE SEQUENCE BED_MOBILITY_VALUES_ID_SEQ ; | |
56 | |
57 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
58 --Infrastructure |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
59 |
8968 | 60 CREATE TABLE infrastructure ( |
61 id NUMERIC(9,0) PRIMARY KEY, | |
62 river_id integer NOT NULL CONSTRAINT cInfrastructureRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
63 annotation_type_id integer NOT NULL CONSTRAINT cInfrastructureAnnotationType REFERENCES annotation_types(id), | |
64 year NUMERIC(4,0) CHECK((year >= 1700) AND (year <= 2199)), | |
65 dataprovider VARCHAR(256), | |
66 evaluation_by VARCHAR(256), | |
67 kmrange_info VARCHAR(32), | |
68 filename VARCHAR(256) NOT NULL, | |
69 "comment" VARCHAR(256) | |
70 ); | |
71 COMMENT ON TABLE infrastructure IS 'Longitudinal section of infrastructures of a river and a type' ; | |
72 COMMENT ON COLUMN infrastructure.year IS 'File header line info "Stand"' ; | |
73 COMMENT ON COLUMN infrastructure.dataprovider IS 'File header line info "Datenherkunft"' ; | |
74 COMMENT ON COLUMN infrastructure.evaluation_by IS 'File header line info "Auswerter"' ; | |
75 COMMENT ON COLUMN infrastructure.kmrange_info IS 'File header line info "Strecke"' ; | |
76 COMMENT ON COLUMN infrastructure.filename IS 'Name without type extension of the imported file' ; | |
77 COMMENT ON COLUMN infrastructure."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
78 | |
79 CREATE SEQUENCE INFRASTRUCTURE_ID_SEQ ; | |
80 | |
81 | |
82 CREATE TABLE infrastructure_values ( | |
83 id NUMERIC(9,0) PRIMARY KEY, | |
84 infrastructure_id NUMERIC(9,0) CONSTRAINT cInfrastructureValuesInfrastructure REFERENCES infrastructure(id) ON DELETE CASCADE, | |
85 station NUMERIC(7,3) NOT NULL, | |
86 attribute_id integer CONSTRAINT cInfrastructureValuesAttributes REFERENCES attributes(id), | |
87 height NUMERIC(6,2) | |
88 ); | |
89 COMMENT ON TABLE infrastructure_values IS 'Infrastructure at a river station' ; | |
90 COMMENT ON COLUMN infrastructure_values.station IS 'River km' ; | |
91 COMMENT ON COLUMN infrastructure_values.height IS 'Geodetic height of the top of the infrastructure in m' ; | |
92 | |
93 CREATE SEQUENCE INFRASTRUCTURE_VALUES_ID_SEQ ; | |
94 | |
95 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
96 --Channel |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
97 |
8968 | 98 CREATE TABLE channel ( |
99 id NUMERIC(9,0) PRIMARY KEY, | |
100 river_id integer NOT NULL CONSTRAINT cChannelRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
101 kmrange_info VARCHAR(32), | |
102 filename VARCHAR(256) NOT NULL, | |
103 "comment" VARCHAR(256), | |
104 year_from NUMERIC(4,0), | |
105 year_to NUMERIC(4,0) | |
106 ); | |
107 COMMENT ON TABLE channel IS 'Longitudinal section of the navigable channel of a river' ; | |
108 COMMENT ON COLUMN channel.kmrange_info IS 'File header line info "Strecke"' ; | |
109 COMMENT ON COLUMN channel.filename IS 'Name without type extension of the imported file' ; | |
110 COMMENT ON COLUMN channel."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
111 COMMENT ON COLUMN channel.year_from IS 'Start year of the period for which the channel values are valid, NULL when valid for the whole past'; | |
112 COMMENT ON COLUMN channel.year_to IS 'End year of the period for which the channel values are valid, NULL when unlimited'; | |
113 | |
114 | |
115 CREATE SEQUENCE CHANNEL_ID_SEQ ; | |
116 | |
117 | |
118 CREATE TABLE channel_values ( | |
119 id NUMERIC(9,0) PRIMARY KEY, | |
120 channel_id NUMERIC(9,0) CONSTRAINT cChannelValuesChannel REFERENCES channel(id) ON DELETE CASCADE, | |
121 station NUMERIC(7,3) NOT NULL, | |
122 width NUMERIC(6,2), | |
123 depth NUMERIC(6,2) | |
124 ); | |
125 COMMENT ON TABLE channel_values IS 'Nominal size of the navigable channel at a river station' ; | |
126 COMMENT ON COLUMN channel_values.station IS 'River km' ; | |
127 COMMENT ON COLUMN channel_values.width IS 'Nominal width of the channel in m' ; | |
128 COMMENT ON COLUMN channel_values.depth IS 'Nominal depth of the channel in m' ; | |
129 | |
130 CREATE SEQUENCE CHANNEL_VALUES_ID_SEQ ; | |
131 | |
132 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
133 --Collision |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
134 |
8968 | 135 CREATE TABLE collision_type ( |
136 id NUMERIC(9,0) PRIMARY KEY, | |
137 name VARCHAR(64) NOT NULL UNIQUE | |
138 ); | |
139 COMMENT ON TABLE collision_type IS 'Type of a ship collision' ; | |
140 COMMENT ON COLUMN collision_type.name IS 'Name of the collision type' ; | |
141 | |
142 CREATE SEQUENCE COLLISION_TYPE_ID_SEQ ; | |
143 | |
144 | |
145 CREATE TABLE collision ( | |
146 id NUMERIC(9,0) PRIMARY KEY, | |
147 river_id integer NOT NULL CONSTRAINT cCollisionRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
148 year NUMERIC(4,0) NOT NULL, | |
149 kmrange_info VARCHAR(32), | |
150 filename VARCHAR(256) NOT NULL, | |
151 "comment" VARCHAR(256) | |
152 ); | |
153 COMMENT ON TABLE collision IS 'Longitudinal section of ship collisions with the river bed' ; | |
154 COMMENT ON COLUMN collision.year IS 'File header line info "Jahr"' ; | |
155 COMMENT ON COLUMN collision.kmrange_info IS 'File header line info "Strecke"' ; | |
156 COMMENT ON COLUMN collision.filename IS 'Name without type extension of the imported file' ; | |
157 COMMENT ON COLUMN collision."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
158 | |
159 CREATE SEQUENCE COLLISION_ID_SEQ ; | |
160 | |
161 | |
162 CREATE TABLE collision_values ( | |
163 id NUMERIC(9,0) PRIMARY KEY, | |
164 collision_id NUMERIC(9,0) NOT NULL CONSTRAINT cCollisionValueCollision REFERENCES collision(id) ON DELETE CASCADE, | |
165 station NUMERIC(7,3) NOT NULL, | |
166 event_date DATE NOT NULL, | |
167 gauge_w NUMERIC(6,2), | |
168 gauge_name VARCHAR(64), | |
169 collision_type_id NUMERIC(9,0) NOT NULL CONSTRAINT cCollisionValuesCollisionType REFERENCES collision_type(id) | |
170 ); | |
171 COMMENT ON TABLE collision_values IS 'Collision event' ; | |
172 COMMENT ON COLUMN collision_values.station IS 'River km' ; | |
173 COMMENT ON COLUMN collision_values.event_date IS 'Date of the collision' ; | |
174 COMMENT ON COLUMN collision_values.gauge_w IS 'Waterlevel during the collision' ; | |
175 COMMENT ON COLUMN collision_values.gauge_name IS 'Name of the gauge' ; | |
176 | |
177 CREATE SEQUENCE COLLISION_VALUES_ID_SEQ ; | |
178 | |
179 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
180 --Tkh |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
181 |
8968 | 182 CREATE TABLE tkh ( |
183 id NUMERIC(9,0) PRIMARY KEY, | |
184 river_id integer NOT NULL CONSTRAINT cTkhRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
185 day DATE, |
8968 | 186 kmrange_info VARCHAR(32), |
187 filename VARCHAR(256) NOT NULL, | |
188 sounding_info VARCHAR(64), | |
189 evaluation_by VARCHAR(256), | |
190 "comment" VARCHAR(256) | |
191 ); | |
8990
07dcedddf839
Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
8968
diff
changeset
|
192 COMMENT ON TABLE tkh IS 'Longitudinal section of computed Transportkörperhöhe of a river' ; |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
193 COMMENT ON COLUMN tkh.day IS 'File header line info "Datum"' ; |
8968 | 194 COMMENT ON COLUMN tkh.kmrange_info IS 'File header line info "Strecke"' ; |
195 COMMENT ON COLUMN tkh.filename IS 'Name without type extension of the imported file' ; | |
196 COMMENT ON COLUMN tkh.sounding_info IS 'File header line info "Peilung"' ; | |
197 COMMENT ON COLUMN tkh.evaluation_by IS 'File header line info "Auswerter"' ; | |
198 COMMENT ON COLUMN tkh."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
199 | |
200 CREATE SEQUENCE TKH_ID_SEQ ; | |
201 | |
202 | |
203 CREATE TABLE tkh_column ( | |
204 id NUMERIC(9,0) PRIMARY KEY, | |
205 tkh_id NUMERIC(9,0) NOT NULL CONSTRAINT cTkhColumnTkh REFERENCES tkh(id) ON DELETE CASCADE, | |
206 name VARCHAR(64) NOT NULL | |
207 ); | |
8990
07dcedddf839
Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
8968
diff
changeset
|
208 COMMENT ON TABLE tkh_column IS 'Longitudinal section of computed Transportkörperhöhe for a waterlevel series' ; |
8968 | 209 COMMENT ON COLUMN tkh_column.name IS 'Name of the tkh computation column' ; |
210 | |
211 CREATE SEQUENCE TKH_COLUMN_ID_SEQ ; | |
212 | |
213 | |
214 CREATE TABLE tkh_values ( | |
215 id NUMERIC(9,0) PRIMARY KEY, | |
216 tkh_column_id NUMERIC(9,0) NOT NULL CONSTRAINT cTkhValuesTkhColumn REFERENCES tkh_column(id) ON DELETE CASCADE, | |
217 station NUMERIC(7,3) NOT NULL, | |
218 tkheight NUMERIC(7,3) | |
219 ); | |
8990
07dcedddf839
Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
8968
diff
changeset
|
220 COMMENT ON TABLE tkh_values IS 'Transportkörperhöhe of a river station and referenced file column' ; |
8968 | 221 COMMENT ON COLUMN tkh_values.station IS 'River km' ; |
8990
07dcedddf839
Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
8968
diff
changeset
|
222 COMMENT ON COLUMN tkh_values.tkheight IS 'Transportkörperhöhe of a river station computed for a waterlevel in m' ; |
8968 | 223 |
224 CREATE SEQUENCE TKH_VALUES_ID_SEQ ; | |
225 | |
226 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
227 --Flow depth |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
228 |
8968 | 229 CREATE TABLE flow_depth ( |
230 id NUMERIC(9,0) PRIMARY KEY, | |
231 river_id integer NOT NULL CONSTRAINT cFlowDepthRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
232 year NUMERIC(4,0) NOT NULL, | |
233 kmrange_info VARCHAR(32), | |
234 filename VARCHAR(256) NOT NULL, | |
235 sounding_info VARCHAR(64), | |
236 evaluation_by VARCHAR(255), | |
237 "comment" VARCHAR(256) | |
238 ); | |
239 | |
240 COMMENT ON TABLE flow_depth IS 'Longitudinal section of computed flow depth of a river' ; | |
241 COMMENT ON COLUMN flow_depth.year IS 'File header line info "Bezugsjahr"' ; | |
242 COMMENT ON COLUMN flow_depth.kmrange_info IS 'File header line info "Strecke"' ; | |
243 COMMENT ON COLUMN flow_depth.filename IS 'Name without type extension of the imported file' ; | |
244 COMMENT ON COLUMN flow_depth.sounding_info IS 'File header line info "Peilung"' ; | |
245 COMMENT ON COLUMN flow_depth.evaluation_by IS 'File header line info "Auswerter"' ; | |
246 COMMENT ON COLUMN flow_depth."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
247 | |
248 CREATE SEQUENCE FLOW_DEPTH_ID_SEQ ; | |
249 | |
250 | |
251 CREATE TABLE flow_depth_column ( | |
252 id NUMERIC(9,0) PRIMARY KEY, | |
253 flow_depth_id NUMERIC(9,0) NOT NULL CONSTRAINT cFlowDepthColumnFlowDepth REFERENCES flow_depth(id) ON DELETE CASCADE, | |
254 name VARCHAR(64) NOT NULL | |
255 ); | |
256 | |
257 COMMENT ON TABLE flow_depth_column IS 'Longitudinal section of computed flow depth for a waterlevel series' ; | |
258 COMMENT ON COLUMN flow_depth_column.name IS 'Name of the flow depth computation column' ; | |
259 | |
260 CREATE SEQUENCE FLOW_DEPTH_COLUMN_ID_SEQ ; | |
261 | |
262 | |
263 CREATE TABLE flow_depth_values ( | |
264 id NUMERIC(9,0) PRIMARY KEY, | |
265 flow_depth_column_id NUMERIC(9,0) NOT NULL CONSTRAINT cFlowDepthValuesFlowDepthColumn REFERENCES flow_depth_column(id) ON DELETE CASCADE, | |
266 station NUMERIC(7,3) NOT NULL, | |
267 depth NUMERIC(7,3) | |
268 ); | |
269 | |
270 COMMENT ON TABLE flow_depth_values IS 'Flow depth of a river station and referenced file column' ; | |
271 COMMENT ON COLUMN flow_depth_values.station IS 'River km' ; | |
272 COMMENT ON COLUMN flow_depth_values.depth IS 'Flow depth of a river station computed for a waterlevel in m' ; | |
273 | |
274 CREATE SEQUENCE FLOW_DEPTH_VALUES_ID_SEQ ; | |
275 | |
276 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
277 --Depth evolution |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
278 |
8968 | 279 CREATE TABLE depth_evolution ( |
280 id NUMERIC(9,0) PRIMARY KEY, | |
281 river_id integer NOT NULL CONSTRAINT cDepthEvolutionRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
282 reference_year NUMERIC(4,0) NOT NULL, | |
283 start_year NUMERIC(4,0) NOT NULL, | |
284 curr_sounding VARCHAR(64) NOT NULL, | |
285 old_sounding VARCHAR(64) NOT NULL, | |
286 kmrange_info VARCHAR(32), | |
287 curr_glw VARCHAR(64) NOT NULL, | |
288 old_glw VARCHAR(64) NOT NULL, | |
289 filename VARCHAR(256) NOT NULL, | |
290 "comment" VARCHAR(256) | |
291 ); | |
292 COMMENT ON TABLE depth_evolution IS 'Longitudinal section of the evolution of the flow depth of a river' ; | |
293 COMMENT ON COLUMN depth_evolution.reference_year IS 'File header line info "Bezugsjahr" (GlW)' ; | |
294 COMMENT ON COLUMN depth_evolution.start_year IS 'File header line info "Ausgangsjahr" (GlW)' ; | |
295 COMMENT ON COLUMN depth_evolution.curr_sounding IS 'File header line info "Aktuelle Peilung / Epoche"' ; | |
296 COMMENT ON COLUMN depth_evolution.old_sounding IS 'File header line info "Historische Peilung / Epoche"' ; | |
297 COMMENT ON COLUMN depth_evolution.kmrange_info IS 'File header line info "Strecke"' ; | |
298 COMMENT ON COLUMN depth_evolution.curr_glw IS 'File header line info "Aktuelle Wasserspiegellage"' ; | |
299 COMMENT ON COLUMN depth_evolution.old_glw IS 'File header line info "Historische Wasserspiegellage"' ; | |
300 COMMENT ON COLUMN depth_evolution.filename IS 'Name without type extension of the imported file' ; | |
301 COMMENT ON COLUMN depth_evolution."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
302 | |
303 CREATE SEQUENCE DEPTH_EVOLUTION_ID_SEQ ; | |
304 | |
305 | |
306 CREATE TABLE depth_evolution_values ( | |
307 id NUMERIC(9,0) PRIMARY KEY, | |
308 depth_evolution_id NUMERIC(9,0) NOT NULL CONSTRAINT cDepthEvolutionValuesDepthEvolution REFERENCES depth_evolution(id) ON DELETE CASCADE, | |
309 station NUMERIC(7,3) NOT NULL, | |
310 total_change NUMERIC(8,4), | |
311 change_per_year NUMERIC(8,4) | |
312 ); | |
313 COMMENT ON TABLE depth_evolution_values IS 'Evolution of the flow depth of a river station in a referenced period of time' ; | |
314 COMMENT ON COLUMN depth_evolution_values.station IS 'River km' ; | |
315 COMMENT ON COLUMN depth_evolution_values.total_change IS 'Flow depth change of the whole period of time in m' ; | |
316 COMMENT ON COLUMN depth_evolution_values.change_per_year IS 'Average yearly flow depth change in the referenced period of time in m' ; | |
317 | |
318 CREATE SEQUENCE DEPTH_EVOLUTION_VALUES_ID_SEQ ; | |
319 | |
320 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
321 --Daily discharge |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
322 |
8968 | 323 CREATE TABLE daily_discharge ( |
324 id NUMERIC(9,0) PRIMARY KEY, | |
325 gauge_id integer NOT NULL CONSTRAINT cDailyDischargeGauge REFERENCES gauges(id) ON DELETE CASCADE, | |
326 filename VARCHAR(256) NOT NULL | |
327 ); | |
328 | |
329 COMMENT ON TABLE daily_discharge IS 'Daily discharge value series' ; | |
330 COMMENT ON COLUMN daily_discharge.filename IS 'Name without type extension of the imported file' ; | |
331 | |
332 CREATE SEQUENCE DAILY_DISCHARGE_ID_SEQ ; | |
333 | |
334 | |
335 CREATE TABLE daily_discharge_values ( | |
336 id NUMERIC(9,0) PRIMARY KEY, | |
337 daily_discharge_id NUMERIC(9,0) NOT NULL CONSTRAINT cDailyDischargeValueDailyDischarge REFERENCES daily_discharge(id) ON DELETE CASCADE, | |
338 day DATE NOT NULL, | |
339 discharge NUMERIC(8,3) NOT NULL | |
340 ); | |
341 | |
342 COMMENT ON TABLE daily_discharge_values IS 'Mean daily discharge of a date and a gauge' ; | |
343 COMMENT ON COLUMN daily_discharge_values.day IS 'Date of the discharge value' ; | |
344 COMMENT ON COLUMN daily_discharge_values.discharge IS 'Mean daily discharge in m^3/s' ; | |
345 | |
346 CREATE SEQUENCE DAILY_DISCHARGE_VALUES_ID_SEQ ; | |
347 | |
348 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
349 --Salix line |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
350 |
8968 | 351 CREATE TABLE salix ( |
352 id NUMERIC(9,0) PRIMARY KEY, | |
353 river_id integer NOT NULL CONSTRAINT cSalixRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
354 evaluation_by VARCHAR(255), | |
355 kmrange_info VARCHAR(32), | |
356 filename VARCHAR(256) NOT NULL, | |
357 "comment" VARCHAR(256) | |
358 ); | |
359 | |
360 COMMENT ON TABLE salix IS 'Longitudinal section of the salix line parameters of a river' ; | |
361 COMMENT ON COLUMN salix.evaluation_by IS 'File header line info "Auswerter"' ; | |
362 COMMENT ON COLUMN salix.kmrange_info IS 'File header line info "Strecke"' ; | |
363 COMMENT ON COLUMN salix.filename IS 'Name without type extension of the imported file' ; | |
364 COMMENT ON COLUMN salix."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
365 | |
366 CREATE SEQUENCE SALIX_ID_SEQ ; | |
367 | |
368 | |
369 CREATE TABLE salix_values ( | |
370 id NUMERIC(9,0) PRIMARY KEY, | |
8990
07dcedddf839
Oracle schema extension added, a few changes in the postgresql schema
mschaefer
parents:
8968
diff
changeset
|
371 salix_id NUMERIC(9,0) NOT NULL CONSTRAINT cSalixValuesSalix REFERENCES salix(id) ON DELETE CASCADE, |
8968 | 372 station NUMERIC(7,3) NOT NULL, |
373 factor NUMERIC(6,2) NOT NULL, | |
374 mnw_mw_diff NUMERIC(6,2) | |
375 ); | |
376 | |
377 COMMENT ON COLUMN salix_values.station IS 'River km' ; | |
378 COMMENT ON COLUMN salix_values.factor IS 'Salix "factor" of the station in m' ; | |
379 COMMENT ON COLUMN salix_values.mnw_mw_diff IS 'Difference between MNW and MW in m (less than zero)' ; | |
380 | |
381 CREATE SEQUENCE SALIX_VALUES_ID_SEQ ; | |
382 | |
383 | |
384 CREATE TABLE salix_rank ( | |
385 id NUMERIC(9,0) PRIMARY KEY, | |
386 min_value NUMERIC(6,2), | |
387 max_value NUMERIC(6,2), | |
388 name VARCHAR(16) NOT NULL | |
389 ); | |
390 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (1, NULL, -0.3, 'invalid'); | |
391 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (2, -0.3, 0.3, 'very good'); | |
392 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (3, 0.3, 0.5, 'good'); | |
393 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (4, 0.5, 1.0, 'moderate'); | |
394 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (5, 1.0, 1.5, 'bad'); | |
395 INSERT INTO salix_rank (id, min_value, max_value, name) VALUES (6, 1.5, NULL, 'very bad'); | |
396 | |
397 | |
9008
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
398 --Vegetation zone |
ce99d3db9477
Column tkh.year replaced by tkh.day, alter bed_height and wsts integrated into sinfo-uinfo script
mschaefer
parents:
8990
diff
changeset
|
399 |
8968 | 400 CREATE TABLE vegetation_type ( |
401 id NUMERIC(9,0) PRIMARY KEY, | |
402 name VARCHAR(256) NOT NULL | |
403 ); | |
404 INSERT INTO vegetation_type (id, name) VALUES (1, 'zonal forest'); | |
405 INSERT INTO vegetation_type (id, name) VALUES (2, 'dry hartwood forest floodplain'); | |
406 INSERT INTO vegetation_type (id, name) VALUES (3, 'wet hartwood forest floodplain'); | |
407 INSERT INTO vegetation_type (id, name) VALUES (4, 'salix alba forest'); | |
408 INSERT INTO vegetation_type (id, name) VALUES (5, 'salix shrubs'); | |
409 INSERT INTO vegetation_type (id, name) VALUES (6, 'reed bed'); | |
410 INSERT INTO vegetation_type (id, name) VALUES (7, 'bank pioneers'); | |
411 INSERT INTO vegetation_type (id, name) VALUES (8, 'no vegetation'); | |
412 INSERT INTO vegetation_type (id, name) VALUES (9, 'water'); | |
413 | |
414 | |
415 CREATE TABLE vegetation ( | |
416 id NUMERIC(9,0) PRIMARY KEY, | |
417 river_id integer NOT NULL CONSTRAINT cVegetationRivers REFERENCES rivers(id) ON DELETE CASCADE, | |
418 name VARCHAR(256), | |
419 filename VARCHAR(256) NOT NULL, | |
420 "comment" VARCHAR(256) | |
421 ); | |
422 | |
423 COMMENT ON TABLE vegetation IS 'Classification of the vegetation of a river' ; | |
424 COMMENT ON COLUMN vegetation.name IS 'File header line info "Einteilung"' ; | |
425 COMMENT ON COLUMN vegetation.filename IS 'Name without type extension of the imported file' ; | |
426 COMMENT ON COLUMN vegetation."comment" IS 'File header line info "weitere Bemerkungen"' ; | |
427 | |
428 CREATE SEQUENCE VEGETATION_ID_SEQ ; | |
429 | |
430 | |
431 CREATE TABLE vegetation_zone ( | |
432 id NUMERIC(9,0) PRIMARY KEY, | |
433 vegetation_id NUMERIC(9,0) NOT NULL CONSTRAINT cVegetationZoneVegetation REFERENCES vegetation(id) ON DELETE CASCADE, | |
434 vegetation_type_id NUMERIC(9,0) NOT NULL CONSTRAINT cVegetationZoneVegetationType REFERENCES vegetation_type(id) ON DELETE CASCADE, | |
435 min_overflow_days NUMERIC(3,0) NOT NULL, | |
436 max_overflow_days NUMERIC(3,0) NOT NULL | |
437 ); | |
438 | |
439 COMMENT ON TABLE vegetation_zone IS 'Vegetation zone of a river station' ; | |
440 COMMENT ON COLUMN vegetation_zone.min_overflow_days IS 'Minimum number (inclusive) of overflow days in a year for the zone type' ; | |
441 COMMENT ON COLUMN vegetation_zone.max_overflow_days IS 'Maximum number (exclusive) of overflow days in a year for the zone type' ; | |
442 | |
443 CREATE SEQUENCE VEGETATION_ZONE_ID_SEQ ; | |
444 | |
445 | |
446 COMMIT; |