comparison flys-backend/doc/schema/postgresql-minfo.sql @ 5452:5287440b57b3

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 27 Mar 2013 11:48:53 +0100
parents b279f2d4bc78
children 303701ab73c6
comparison
equal deleted inserted replaced
5451:278d8759c92b 5452:5287440b57b3
38 CREATE SEQUENCE BED_HEIGHT_SINGLE_ID_SEQ; 38 CREATE SEQUENCE BED_HEIGHT_SINGLE_ID_SEQ;
39 39
40 CREATE TABLE bed_height_single ( 40 CREATE TABLE bed_height_single (
41 id int NOT NULL, 41 id int NOT NULL,
42 river_id int NOT NULL, 42 river_id int NOT NULL,
43 year int NOT NULL, 43 year int,
44 sounding_width int NOT NULL, 44 sounding_width int,
45 type_id int NOT NULL, 45 type_id int NOT NULL,
46 location_system_id int NOT NULL, 46 location_system_id int NOT NULL,
47 cur_elevation_model_id int NOT NULL, 47 cur_elevation_model_id int NOT NULL,
48 old_elevation_model_id int, 48 old_elevation_model_id int,
49 range_id int NOT NULL, 49 range_id int,
50 evaluation_by VARCHAR(255), 50 evaluation_by VARCHAR(255),
51 description VARCHAR(255), 51 description VARCHAR(255),
52 PRIMARY KEY(id), 52 PRIMARY KEY(id),
53 CONSTRAINT fk_bed_single_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, 53 CONSTRAINT fk_bed_single_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
54 CONSTRAINT fk_type FOREIGN KEY (type_id) REFERENCES bed_height_type(id), 54 CONSTRAINT fk_type FOREIGN KEY (type_id) REFERENCES bed_height_type(id),
67 time_interval_id int NOT NULL, 67 time_interval_id int NOT NULL,
68 -- sounding_with int NOT NULL, 68 -- sounding_with int NOT NULL,
69 -- type_id int NOT NULL, 69 -- type_id int NOT NULL,
70 cur_elevation_model_id int NOT NULL, 70 cur_elevation_model_id int NOT NULL,
71 old_elevation_model_id int, 71 old_elevation_model_id int,
72 range_id int NOT NULL, 72 range_id int,
73 evaluation_by VARCHAR(255), 73 evaluation_by VARCHAR(255),
74 description VARCHAR(255), 74 description VARCHAR(255),
75 PRIMARY KEY(id), 75 PRIMARY KEY(id),
76 CONSTRAINT fk_time_interval FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id), 76 CONSTRAINT fk_time_interval FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id),
77 CONSTRAINT fk_epoch_cur_elevation_model FOREIGN KEY (cur_elevation_model_id) REFERENCES elevation_model(id), 77 CONSTRAINT fk_epoch_cur_elevation_model FOREIGN KEY (cur_elevation_model_id) REFERENCES elevation_model(id),
112 112
113 CREATE TABLE depths ( 113 CREATE TABLE depths (
114 id int NOT NULL, 114 id int NOT NULL,
115 lower NUMERIC NOT NULL, 115 lower NUMERIC NOT NULL,
116 upper NUMERIC NOT NULL, 116 upper NUMERIC NOT NULL,
117 unit_id int NOT NULL, 117 PRIMARY KEY(id)
118 PRIMARY KEY(id),
119 CONSTRAINT fk_depths_unit_id FOREIGN KEY (unit_id) REFERENCES units(id)
120 ); 118 );
121 119
122 120
123 CREATE SEQUENCE SEDIMENT_DENSITY_ID_SEQ; 121 CREATE SEQUENCE SEDIMENT_DENSITY_ID_SEQ;
124 122
125 CREATE TABLE sediment_density ( 123 CREATE TABLE sediment_density (
126 id int NOT NULL, 124 id int NOT NULL,
127 river_id int NOT NULL, 125 river_id int NOT NULL,
128 depth_id int NOT NULL, 126 depth_id int NOT NULL,
129 unit_id int NOT NULL,
130 description VARCHAR(256), 127 description VARCHAR(256),
131 PRIMARY KEY(id), 128 PRIMARY KEY(id),
132 CONSTRAINT fk_sd_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, 129 CONSTRAINT fk_sd_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
133 CONSTRAINT fk_sd_depth_id FOREIGN KEY (depth_id) REFERENCES depths(id), 130 CONSTRAINT fk_sd_depth_id FOREIGN KEY (depth_id) REFERENCES depths(id)
134 CONSTRAINT fk_sd_unit_id FOREIGN KEY (unit_id) REFERENCES units(id)
135 ); 131 );
136 132
137 133
138 CREATE SEQUENCE SEDIMENT_DENSITY_VALUES_ID_SEQ; 134 CREATE SEQUENCE SEDIMENT_DENSITY_VALUES_ID_SEQ;
139 135
285 CREATE TABLE measurement_station ( 281 CREATE TABLE measurement_station (
286 id int NOT NULL, 282 id int NOT NULL,
287 name VARCHAR(256) NOT NULL, 283 name VARCHAR(256) NOT NULL,
288 river_id int NOT NULL, 284 river_id int NOT NULL,
289 station NUMERIC NOT NULL, 285 station NUMERIC NOT NULL,
290 range_id int NOT NULL, 286 range_id int,
291 measurement_type VARCHAR(64) NOT NULL, 287 measurement_type VARCHAR(64) NOT NULL,
292 riverside VARCHAR(16), 288 riverside VARCHAR(16),
293 reference_gauge_id int, 289 reference_gauge_id int,
294 observation_timerange_id int, 290 observation_timerange_id int,
295 operator VARCHAR(64), 291 operator VARCHAR(64),
320 316
321 CREATE TABLE sq_relation_value ( 317 CREATE TABLE sq_relation_value (
322 id int NOT NULL, 318 id int NOT NULL,
323 sq_relation_id int NOT NULL, 319 sq_relation_id int NOT NULL,
324 measurement_station_id int NOT NULL, 320 measurement_station_id int NOT NULL,
325 parameter VARCHAR(16) NOT NULL,
326 fraction VARCHAR(32) NOT NULL, 321 fraction VARCHAR(32) NOT NULL,
327 a NUMERIC NOT NULL, 322 a NUMERIC NOT NULL,
328 b NUMERIC NOT NULL, 323 b NUMERIC NOT NULL,
329 qmax NUMERIC, 324 qmax NUMERIC,
330 rsq NUMERIC, 325 rsq NUMERIC,
332 noutl int, 327 noutl int,
333 cferguson NUMERIC, 328 cferguson NUMERIC,
334 cduan NUMERIC, 329 cduan NUMERIC,
335 PRIMARY KEY (id), 330 PRIMARY KEY (id),
336 CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id) ON DELETE CASCADE, 331 CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id) ON DELETE CASCADE,
337 CONSTRAINT fk_mstation_id FOREIGN KEY (m_station_id) REFERENCES measurement_station(id) 332 CONSTRAINT fk_mstation_id FOREIGN KEY (measurement_station_id) REFERENCES measurement_station(id)
338 ); 333 );
339 COMMIT; 334 COMMIT;

http://dive4elements.wald.intevation.org