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