comparison flys-backend/doc/schema/oracle.sql @ 2354:40093215061b

Removed all CREATE OR REPLACE TRIGGER statements. flys-backend/trunk@2999 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Schilberg <bjoern@intevation.de>
date Tue, 18 Oct 2011 10:25:00 +0000
parents 67e0371f6f40
children cf8dcfaeb756
comparison
equal deleted inserted replaced
2353:67e0371f6f40 2354:40093215061b
5 id NUMBER(38,0) NOT NULL, 5 id NUMBER(38,0) NOT NULL,
6 name VARCHAR2(255), 6 name VARCHAR2(255),
7 PRIMARY KEY (id) 7 PRIMARY KEY (id)
8 ); 8 );
9 9
10 CREATE OR REPLACE TRIGGER annotation_types_trigger BEFORE INSERT ON annotation_types FOR each ROW
11 BEGIN
12 SELECT ANNOTATION_TYPES_ID_SEQ.nextval INTO :new.id FROM dual;
13 END;
14 /
15 10
16 -- ANNOTATIONS 11 -- ANNOTATIONS
17 CREATE SEQUENCE ANNOTATIONS_ID_SEQ; 12 CREATE SEQUENCE ANNOTATIONS_ID_SEQ;
18 13
19 CREATE TABLE annotations ( 14 CREATE TABLE annotations (
24 range_id NUMBER(38,0), 19 range_id NUMBER(38,0),
25 type_id NUMBER(38,0), 20 type_id NUMBER(38,0),
26 PRIMARY KEY (id) 21 PRIMARY KEY (id)
27 ); 22 );
28 23
29 CREATE OR REPLACE TRIGGER annotations_trigger BEFORE INSERT ON annotations FOR each ROW
30 BEGIN
31 SELECT ANNOTATIONS_ID_SEQ.nextval INTO :new.id FROM dual;
32 END;
33 /
34
35 24
36 -- ATTRIBUTES 25 -- ATTRIBUTES
37 CREATE SEQUENCE ATTRIBUTES_ID_SEQ; 26 CREATE SEQUENCE ATTRIBUTES_ID_SEQ;
38 27
39 CREATE TABLE attributes ( 28 CREATE TABLE attributes (
40 id NUMBER(38,0) NOT NULL, 29 id NUMBER(38,0) NOT NULL,
41 value VARCHAR2(255), 30 value VARCHAR2(255),
42 primary key (id) 31 primary key (id)
43 ); 32 );
44 33
45 CREATE OR REPLACE TRIGGER attributes_trigger BEFORE INSERT ON attributes FOR each ROW
46 BEGIN
47 SELECT ATTRIBUTES_ID_SEQ.nextval INTO :new.id FROM dual;
48 END;
49 /
50 34
51 -- CROSS_SECTION_LINES 35 -- CROSS_SECTION_LINES
52 CREATE SEQUENCE CROSS_SECTION_LINES_ID_SEQ; 36 CREATE SEQUENCE CROSS_SECTION_LINES_ID_SEQ;
53 37
54 CREATE TABLE cross_section_lines ( 38 CREATE TABLE cross_section_lines (
55 id NUMBER(38,0) NOT NULL, 39 id NUMBER(38,0) NOT NULL,
56 km NUMBER(38,2), 40 km NUMBER(38,2),
57 cross_section_id NUMBER(38,0), 41 cross_section_id NUMBER(38,0),
58 PRIMARY KEY (id) 42 PRIMARY KEY (id)
59 ); 43 );
60
61 CREATE OR REPLACE TRIGGER cross_section_lines_trigger BEFORE INSERT ON cross_section_lines FOR each ROW
62 BEGIN
63 SELECT CROSS_SECTION_LINES_ID_SEQ.nextval INTO :new.id FROM dual;
64 END;
65 /
66 44
67 45
68 -- CROSS_SECTION_POINTS 46 -- CROSS_SECTION_POINTS
69 CREATE SEQUENCE CROSS_SECTION_POINTS_ID_SEQ; 47 CREATE SEQUENCE CROSS_SECTION_POINTS_ID_SEQ;
70 48
75 y NUMBER(38,2), 53 y NUMBER(38,2),
76 cross_section_line_id NUMBER(38,0), 54 cross_section_line_id NUMBER(38,0),
77 PRIMARY KEY (id) 55 PRIMARY KEY (id)
78 ); 56 );
79 57
80 CREATE OR REPLACE TRIGGER cross_section_points_trigger BEFORE INSERT ON cross_section_points FOR each ROW
81 BEGIN
82 SELECT CROSS_SECTION_POINTS_ID_SEQ.nextval INTO :new.id FROM dual;
83 END;
84 /
85
86 58
87 -- CROSS_SECTIONS 59 -- CROSS_SECTIONS
88 create sequence CROSS_SECTIONS_ID_SEQ; 60 create sequence CROSS_SECTIONS_ID_SEQ;
89 61
90 create table cross_sections ( 62 create table cross_sections (
92 description VARCHAR2(255), 64 description VARCHAR2(255),
93 river_id NUMBER(38,0), 65 river_id NUMBER(38,0),
94 time_interval_id NUMBER(38,0), 66 time_interval_id NUMBER(38,0),
95 PRIMARY KEY (id) 67 PRIMARY KEY (id)
96 ); 68 );
97
98 CREATE OR REPLACE TRIGGER cross_sections_trigger BEFORE INSERT ON cross_sections FOR each ROW
99 BEGIN
100 SELECT CROSS_SECTIONS_ID_SEQ.nextval INTO :new.id FROM dual;
101 END;
102 /
103 69
104 70
105 -- DISCHARGE_TABLE_VALUES 71 -- DISCHARGE_TABLE_VALUES
106 CREATE SEQUENCE DISCHARGE_TABLE_VALUES_ID_SEQ; 72 CREATE SEQUENCE DISCHARGE_TABLE_VALUES_ID_SEQ;
107 73
111 w NUMBER(38,2), 77 w NUMBER(38,2),
112 table_id NUMBER(38,0), 78 table_id NUMBER(38,0),
113 PRIMARY KEY (id) 79 PRIMARY KEY (id)
114 ); 80 );
115 81
116 CREATE OR REPLACE TRIGGER discharge_table_values_trigger BEFORE INSERT ON discharge_table_values FOR each ROW
117 BEGIN
118 SELECT DISCHARGE_TABLE_VALUES_ID_SEQ.nextval INTO :new.id FROM dual;
119 END;
120 /
121
122 82
123 -- DISCHARGE_TABLES 83 -- DISCHARGE_TABLES
124 CREATE SEQUENCE DISCHARGE_TABLES_ID_SEQ; 84 CREATE SEQUENCE DISCHARGE_TABLES_ID_SEQ;
125 85
126 CREATE TABLE discharge_tables ( 86 CREATE TABLE discharge_tables (
130 gauge_id NUMBER(38,0), 90 gauge_id NUMBER(38,0),
131 time_interval_id NUMBER(38,0), 91 time_interval_id NUMBER(38,0),
132 PRIMARY KEY (id) 92 PRIMARY KEY (id)
133 ); 93 );
134 94
135 CREATE OR REPLACE TRIGGER discharge_tables_trigger BEFORE INSERT ON discharge_tables FOR each ROW
136 BEGIN
137 SELECT DISCHARGE_TABLES_ID_SEQ.nextval INTO :new.id FROM dual;
138 END;
139 /
140
141 95
142 -- EDGES 96 -- EDGES
143 CREATE SEQUENCE EDGES_ID_SEQ; 97 CREATE SEQUENCE EDGES_ID_SEQ;
144 98
145 CREATE TABLE edges ( 99 CREATE TABLE edges (
147 bottom NUMBER(38,2), 101 bottom NUMBER(38,2),
148 top NUMBER(38,2), 102 top NUMBER(38,2),
149 PRIMARY KEY (id) 103 PRIMARY KEY (id)
150 ); 104 );
151 105
152 CREATE OR REPLACE TRIGGER edges_trigger BEFORE INSERT ON edges FOR each ROW
153 BEGIN
154 SELECT EDGES_ID_SEQ.nextval INTO :new.id FROM dual;
155 END;
156 /
157 106
158 -- GAUGES 107 -- GAUGES
159 CREATE SEQUENCE GAUGES_ID_SEQ; 108 CREATE SEQUENCE GAUGES_ID_SEQ;
160 109
161 CREATE TABLE gauges ( 110 CREATE TABLE gauges (
166 station NUMBER(38,2), 115 station NUMBER(38,2),
167 range_id NUMBER(38,0), 116 range_id NUMBER(38,0),
168 river_id NUMBER(38,0), 117 river_id NUMBER(38,0),
169 PRIMARY KEY (id) 118 PRIMARY KEY (id)
170 ); 119 );
171
172 CREATE OR REPLACE TRIGGER gauges_trigger BEFORE INSERT ON gauges FOR each ROW
173 BEGIN
174 SELECT GAUGES_ID_SEQ.nextval INTO :new.id FROM dual;
175 END;
176 /
177 120
178 121
179 -- HYK_ENTRIES 122 -- HYK_ENTRIES
180 CREATE SEQUENCE HYK_ENTRIES_ID_SEQ; 123 CREATE SEQUENCE HYK_ENTRIES_ID_SEQ;
181 124
185 measure TIMESTAMP, 128 measure TIMESTAMP,
186 hyk_id NUMBER(38,0), 129 hyk_id NUMBER(38,0),
187 PRIMARY KEY (id) 130 PRIMARY KEY (id)
188 ); 131 );
189 132
190 CREATE OR REPLACE TRIGGER hyk_entries_trigger BEFORE INSERT ON hyk_entries FOR each ROW
191 BEGIN
192 SELECT HYK_ENTRIES_ID_SEQ.nextval INTO :new.id FROM dual;
193 END;
194 /
195
196 133
197 -- HYK_FLOW_ZONE_TYPES 134 -- HYK_FLOW_ZONE_TYPES
198 CREATE SEQUENCE HYK_FLOW_ZONE_TYPES_ID_SEQ; 135 CREATE SEQUENCE HYK_FLOW_ZONE_TYPES_ID_SEQ;
199 136
200 CREATE TABLE hyk_flow_zone_types ( 137 CREATE TABLE hyk_flow_zone_types (
202 description VARCHAR2(255), 139 description VARCHAR2(255),
203 name VARCHAR2(255), 140 name VARCHAR2(255),
204 PRIMARY KEY (id) 141 PRIMARY KEY (id)
205 ); 142 );
206 143
207 CREATE OR REPLACE TRIGGER hyk_flow_zone_types_trigger BEFORE INSERT ON hyk_flow_zone_types FOR each ROW
208 BEGIN
209 SELECT HYK_FLOW_ZONE_TYPES_ID_SEQ.nextval INTO :new.id FROM dual;
210 END;
211 /
212 144
213 -- HYK_FLOW_ZONES 145 -- HYK_FLOW_ZONES
214 CREATE SEQUENCE HYK_FLOW_ZONES_ID_SEQ; 146 CREATE SEQUENCE HYK_FLOW_ZONES_ID_SEQ;
215 147
216 CREATE TABLE hyk_flow_zones ( 148 CREATE TABLE hyk_flow_zones (
219 b NUMBER(38,2), 151 b NUMBER(38,2),
220 formation_id NUMBER(38,0), 152 formation_id NUMBER(38,0),
221 type_id NUMBER(38,0), 153 type_id NUMBER(38,0),
222 primary key (id) 154 primary key (id)
223 ); 155 );
224
225 CREATE OR REPLACE TRIGGER hyk_flow_zones_trigger BEFORE INSERT ON hyk_flow_zones FOR each ROW
226 BEGIN
227 SELECT HYK_FLOW_ZONES_ID_SEQ.nextval INTO :new.id FROM dual;
228 END;
229 /
230 156
231 157
232 -- HYK_FORMATIONS 158 -- HYK_FORMATIONS
233 CREATE SEQUENCE HYK_FORMATIONS_ID_SEQ; 159 CREATE SEQUENCE HYK_FORMATIONS_ID_SEQ;
234 160
242 top NUMBER(38,2), 168 top NUMBER(38,2),
243 hyk_entry_id NUMBER(38,0), 169 hyk_entry_id NUMBER(38,0),
244 PRIMARY KEY (id) 170 PRIMARY KEY (id)
245 ); 171 );
246 172
247 CREATE OR REPLACE TRIGGER hyk_formations_trigger BEFORE INSERT ON hyk_formations FOR each ROW
248 BEGIN
249 SELECT HYK_FORMATIONS_ID_SEQ.nextval INTO :new.id FROM dual;
250 END;
251 /
252
253 173
254 -- HYKS 174 -- HYKS
255 CREATE SEQUENCE HYKS_ID_SEQ; 175 CREATE SEQUENCE HYKS_ID_SEQ;
256 176
257 CREATE TABLE hyks ( 177 CREATE TABLE hyks (
259 description VARCHAR2(255), 179 description VARCHAR2(255),
260 river_id NUMBER(38,0), 180 river_id NUMBER(38,0),
261 primary key (id) 181 primary key (id)
262 ); 182 );
263 183
264 CREATE OR REPLACE TRIGGER hyks_trigger BEFORE INSERT ON hyks FOR each ROW
265 BEGIN
266 SELECT HYKS_ID_SEQ.nextval INTO :new.id FROM dual;
267 END;
268 /
269
270 184
271 -- MAIN_VALUE_TYPES 185 -- MAIN_VALUE_TYPES
272 CREATE SEQUENCE MAIN_VALUE_TYPES_ID_SEQ; 186 CREATE SEQUENCE MAIN_VALUE_TYPES_ID_SEQ;
273 187
274 CREATE TABLE main_value_types ( 188 CREATE TABLE main_value_types (
275 id NUMBER(38,0) NOT NULL, 189 id NUMBER(38,0) NOT NULL,
276 name VARCHAR2(255), 190 name VARCHAR2(255),
277 PRIMARY KEY (id) 191 PRIMARY KEY (id)
278 ); 192 );
279 193
280 CREATE OR REPLACE TRIGGER main_value_types_trigger BEFORE INSERT ON main_value_types FOR each ROW
281 BEGIN
282 SELECT MAIN_VALUE_TYPES_ID_SEQ.nextval INTO :new.id FROM dual;
283 END;
284 /
285 194
286 -- MAIN_VALUES 195 -- MAIN_VALUES
287 CREATE SEQUENCE MAIN_VALUES_ID_SEQ; 196 CREATE SEQUENCE MAIN_VALUES_ID_SEQ;
288 197
289 CREATE TABLE main_values ( 198 CREATE TABLE main_values (
293 named_value_id NUMBER(38,0), 202 named_value_id NUMBER(38,0),
294 time_interval_id NUMBER(38,0), 203 time_interval_id NUMBER(38,0),
295 PRIMARY KEY (id) 204 PRIMARY KEY (id)
296 ); 205 );
297 206
298 CREATE OR REPLACE TRIGGER main_values_trigger BEFORE INSERT ON main_values FOR each ROW
299 BEGIN
300 SELECT MAIN_VALUES_ID_SEQ.nextval INTO :new.id FROM dual;
301 END;
302 /
303
304 207
305 -- NAMED_MAIN_VALUES 208 -- NAMED_MAIN_VALUES
306 CREATE SEQUENCE NAMED_MAIN_VALUES_ID_SEQ; 209 CREATE SEQUENCE NAMED_MAIN_VALUES_ID_SEQ;
307 210
308 CREATE TABLE named_main_values ( 211 CREATE TABLE named_main_values (
310 name VARCHAR2(255), 213 name VARCHAR2(255),
311 type_id NUMBER(38,0), 214 type_id NUMBER(38,0),
312 PRIMARY KEY (id) 215 PRIMARY KEY (id)
313 ); 216 );
314 217
315 CREATE OR REPLACE TRIGGER named_main_values_trigger BEFORE INSERT ON named_main_values FOR each ROW
316 BEGIN
317 SELECT NAMED_MAIN_VALUES_ID_SEQ.nextval INTO :new.id FROM dual;
318 END;
319 /
320
321 218
322 -- POSITIONS 219 -- POSITIONS
323 CREATE SEQUENCE POSITIONS_ID_SEQ; 220 CREATE SEQUENCE POSITIONS_ID_SEQ;
324 221
325 CREATE TABLE positions ( 222 CREATE TABLE positions (
326 id NUMBER(38,0) NOT NULL, 223 id NUMBER(38,0) NOT NULL,
327 value VARCHAR2(255 char), 224 value VARCHAR2(255 char),
328 PRIMARY KEY (id) 225 PRIMARY KEY (id)
329 ); 226 );
330 227
331 CREATE OR REPLACE TRIGGER positions_trigger BEFORE INSERT ON positions FOR each ROW
332 BEGIN
333 SELECT POSITIONS_ID_SEQ.nextval INTO :new.id FROM dual;
334 END;
335 /
336 228
337 --- RANGES 229 --- RANGES
338 CREATE SEQUENCE RANGES_ID_SEQ; 230 CREATE SEQUENCE RANGES_ID_SEQ;
339 231
340 CREATE TABLE ranges ( 232 CREATE TABLE ranges (
343 b NUMBER(38,2), 235 b NUMBER(38,2),
344 river_id NUMBER(38,0), 236 river_id NUMBER(38,0),
345 PRIMARY KEY (id) 237 PRIMARY KEY (id)
346 ); 238 );
347 239
348 CREATE OR REPLACE TRIGGER ranges_trigger BEFORE INSERT ON ranges FOR each ROW
349 BEGIN
350 SELECT RANGES_ID_SEQ.nextval INTO :new.id FROM dual;
351 END;
352 /
353
354 240
355 -- RIVERS 241 -- RIVERS
356 CREATE SEQUENCE RIVERS_ID_SEQ; 242 CREATE SEQUENCE RIVERS_ID_SEQ;
357 243
358 CREATE TABLE rivers ( 244 CREATE TABLE rivers (
360 km_up NUMBER(38,0), 246 km_up NUMBER(38,0),
361 name VARCHAR2(255), 247 name VARCHAR2(255),
362 wst_unit_id NUMBER(38,0), 248 wst_unit_id NUMBER(38,0),
363 PRIMARY KEY (id) 249 PRIMARY KEY (id)
364 ); 250 );
365
366 CREATE OR REPLACE TRIGGER rivers_trigger BEFORE INSERT ON rivers FOR each ROW
367 BEGIN
368 SELECT RIVERS_ID_SEQ.nextval INTO :new.id FROM dual;
369 END;
370 /
371 251
372 252
373 -- TIME_INTERVALS 253 -- TIME_INTERVALS
374 CREATE SEQUENCE TIME_INTERVALS_ID_SEQ; 254 CREATE SEQUENCE TIME_INTERVALS_ID_SEQ;
375 255
378 start_time TIMESTAMP, 258 start_time TIMESTAMP,
379 stop_time TIMESTAMP, 259 stop_time TIMESTAMP,
380 PRIMARY KEY (id) 260 PRIMARY KEY (id)
381 ); 261 );
382 262
383 CREATE OR REPLACE TRIGGER time_intervals_trigger BEFORE INSERT ON time_intervals FOR each ROW
384 BEGIN
385 SELECT TIME_INTERVALS_ID_SEQ.nextval INTO :new.id FROM dual;
386 END;
387 /
388 263
389 --- UNITS 264 --- UNITS
390 CREATE SEQUENCE UNITS_ID_SEQ; 265 CREATE SEQUENCE UNITS_ID_SEQ;
391 266
392 CREATE TABLE units ( 267 CREATE TABLE units (
393 id NUMBER(38,0) NOT NULL, 268 id NUMBER(38,0) NOT NULL,
394 name VARCHAR2(255), 269 name VARCHAR2(255),
395 PRIMARY KEY (id) 270 PRIMARY KEY (id)
396 ); 271 );
397 272
398 CREATE OR REPLACE TRIGGER units_trigger BEFORE INSERT ON units FOR each ROW
399 BEGIN
400 SELECT UNITS_ID_SEQ.nextval INTO :new.id FROM dual;
401 END;
402 /
403 273
404 -- WST_COLUMN_Q_RANGES 274 -- WST_COLUMN_Q_RANGES
405 CREATE SEQUENCE WST_COLUMN_Q_RANGES_ID_SEQ; 275 CREATE SEQUENCE WST_COLUMN_Q_RANGES_ID_SEQ;
406 276
407 CREATE TABLE wst_column_q_ranges ( 277 CREATE TABLE wst_column_q_ranges (
408 id NUMBER(38,0) NOT NULL, 278 id NUMBER(38,0) NOT NULL,
409 wst_column_id NUMBER(38,0), 279 wst_column_id NUMBER(38,0),
410 wst_q_range_id NUMBER(38,0), 280 wst_q_range_id NUMBER(38,0),
411 PRIMARY KEY (id) 281 PRIMARY KEY (id)
412 ); 282 );
413
414 CREATE OR REPLACE TRIGGER wst_column_q_ranges_trigger BEFORE INSERT ON wst_column_q_ranges FOR each ROW
415 BEGIN
416 SELECT WST_COLUMN_Q_RANGES_ID_SEQ.nextval INTO :new.id FROM dual;
417 END;
418 /
419 283
420 284
421 -- WST_COLUMN_VALUES 285 -- WST_COLUMN_VALUES
422 CREATE SEQUENCE WST_COLUMN_VALUES_ID_SEQ; 286 CREATE SEQUENCE WST_COLUMN_VALUES_ID_SEQ;
423 287
427 w NUMBER(38,2), 291 w NUMBER(38,2),
428 wst_column_id NUMBER(38,0), 292 wst_column_id NUMBER(38,0),
429 PRIMARY KEY (id) 293 PRIMARY KEY (id)
430 ); 294 );
431 295
432 CREATE OR REPLACE TRIGGER wst_column_values_trigger BEFORE INSERT ON wst_column_values FOR each ROW
433 BEGIN
434 SELECT WST_COLUMN_VALUES_ID_SEQ.nextval INTO :new.id FROM dual;
435 END;
436 /
437
438 296
439 -- WST_COLUMNS 297 -- WST_COLUMNS
440 CREATE SEQUENCE WST_COLUMNS_ID_SEQ; 298 CREATE SEQUENCE WST_COLUMNS_ID_SEQ;
441 299
442 CREATE TABLE wst_columns ( 300 CREATE TABLE wst_columns (
447 time_interval_id NUMBER(38,0), 305 time_interval_id NUMBER(38,0),
448 wst_id NUMBER(38,0), 306 wst_id NUMBER(38,0),
449 PRIMARY KEY (id) 307 PRIMARY KEY (id)
450 ); 308 );
451 309
452 CREATE OR REPLACE TRIGGER wst_columns_trigger BEFORE INSERT ON wst_columns FOR each ROW
453 BEGIN
454 SELECT WST_COLUMNS_ID_SEQ.nextval INTO :new.id FROM dual;
455 END;
456 /
457
458 310
459 -- WST_Q_RANGES 311 -- WST_Q_RANGES
460 CREATE SEQUENCE WST_Q_RANGES_ID_SEQ; 312 CREATE SEQUENCE WST_Q_RANGES_ID_SEQ;
461 313
462 CREATE TABLE wst_q_ranges ( 314 CREATE TABLE wst_q_ranges (
464 q NUMBER(38,2), 316 q NUMBER(38,2),
465 range_id NUMBER(38,0), 317 range_id NUMBER(38,0),
466 PRIMARY KEY (id) 318 PRIMARY KEY (id)
467 ); 319 );
468 320
469 CREATE OR REPLACE TRIGGER wst_q_ranges_trigger BEFORE INSERT ON wst_q_ranges FOR each ROW
470 BEGIN
471 SELECT WST_Q_RANGES_ID_SEQ.nextval INTO :new.id FROM dual;
472 END;
473 /
474
475 321
476 -- WSTS 322 -- WSTS
477 CREATE SEQUENCE WSTS_ID_SEQ; 323 CREATE SEQUENCE WSTS_ID_SEQ;
478 324
479 CREATE TABLE wsts ( 325 CREATE TABLE wsts (
481 description VARCHAR2(255), 327 description VARCHAR2(255),
482 kind NUMBER(38,0), 328 kind NUMBER(38,0),
483 river_id NUMBER(38,0), 329 river_id NUMBER(38,0),
484 PRIMARY KEY (id) 330 PRIMARY KEY (id)
485 ); 331 );
486
487
488 CREATE OR REPLACE TRIGGER wsts_trigger BEFORE INSERT ON wsts FOR each ROW
489 BEGIN
490 SELECT WSTS_ID_SEQ.nextval INTO :new.id FROM dual;
491 END;
492 /
493 332
494 333
495 -- ADD CONSTRAINTs 334 -- ADD CONSTRAINTs
496 ALTER TABLE annotations ADD CONSTRAINT cAnnotationsRanges FOREIGN KEY (range_id) REFERENCES ranges; 335 ALTER TABLE annotations ADD CONSTRAINT cAnnotationsRanges FOREIGN KEY (range_id) REFERENCES ranges;
497 ALTER TABLE annotations ADD CONSTRAINT cAnnotationsEdges FOREIGN KEY (edge_id) REFERENCES edges; 336 ALTER TABLE annotations ADD CONSTRAINT cAnnotationsEdges FOREIGN KEY (edge_id) REFERENCES edges;

http://dive4elements.wald.intevation.org