comparison flys-backend/doc/schema/postgresql-minfo.sql @ 5448:b279f2d4bc78

SCHEMA CHANGE: fixed constraints in MINFO and removed obsolete column
author Tom Gottfried <tom.gottfried@intevation.de>
date Wed, 27 Mar 2013 10:25:45 +0100
parents 7c1dd9c3f6bd
children 303701ab73c6
comparison
equal deleted inserted replaced
5447:7876163fc40e 5448:b279f2d4bc78
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),
281 CREATE TABLE measurement_station ( 281 CREATE TABLE measurement_station (
282 id int NOT NULL, 282 id int NOT NULL,
283 name VARCHAR(256) NOT NULL, 283 name VARCHAR(256) NOT NULL,
284 river_id int NOT NULL, 284 river_id int NOT NULL,
285 station NUMERIC NOT NULL, 285 station NUMERIC NOT NULL,
286 range_id int NOT NULL, 286 range_id int,
287 measurement_type VARCHAR(64) NOT NULL, 287 measurement_type VARCHAR(64) NOT NULL,
288 riverside VARCHAR(16), 288 riverside VARCHAR(16),
289 reference_gauge_id int, 289 reference_gauge_id int,
290 observation_timerange_id int, 290 observation_timerange_id int,
291 operator VARCHAR(64), 291 operator VARCHAR(64),
316 316
317 CREATE TABLE sq_relation_value ( 317 CREATE TABLE sq_relation_value (
318 id int NOT NULL, 318 id int NOT NULL,
319 sq_relation_id int NOT NULL, 319 sq_relation_id int NOT NULL,
320 measurement_station_id int NOT NULL, 320 measurement_station_id int NOT NULL,
321 parameter VARCHAR(16) NOT NULL,
322 fraction VARCHAR(32) NOT NULL, 321 fraction VARCHAR(32) NOT NULL,
323 a NUMERIC NOT NULL, 322 a NUMERIC NOT NULL,
324 b NUMERIC NOT NULL, 323 b NUMERIC NOT NULL,
325 qmax NUMERIC, 324 qmax NUMERIC,
326 rsq NUMERIC, 325 rsq NUMERIC,
328 noutl int, 327 noutl int,
329 cferguson NUMERIC, 328 cferguson NUMERIC,
330 cduan NUMERIC, 329 cduan NUMERIC,
331 PRIMARY KEY (id), 330 PRIMARY KEY (id),
332 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,
333 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)
334 ); 333 );
335 COMMIT; 334 COMMIT;

http://dive4elements.wald.intevation.org