Mercurial > dive4elements > river
diff flys-backend/doc/schema/postgresql-minfo.sql @ 5540:25c2505df28f
Merged
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 03 Apr 2013 16:00:21 +0200 |
parents | db6c7268b08e |
children | 88cbe798cbab |
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql-minfo.sql Wed Apr 03 15:59:01 2013 +0200 +++ b/flys-backend/doc/schema/postgresql-minfo.sql Wed Apr 03 16:00:21 2013 +0200 @@ -40,13 +40,13 @@ CREATE TABLE bed_height_single ( id int NOT NULL, river_id int NOT NULL, - year int NOT NULL, - sounding_width int NOT NULL, + year int, + sounding_width int, type_id int NOT NULL, location_system_id int NOT NULL, cur_elevation_model_id int NOT NULL, old_elevation_model_id int, - range_id int NOT NULL, + range_id int, evaluation_by VARCHAR(255), description VARCHAR(255), PRIMARY KEY(id), @@ -69,7 +69,7 @@ -- type_id int NOT NULL, cur_elevation_model_id int NOT NULL, old_elevation_model_id int, - range_id int NOT NULL, + range_id int, evaluation_by VARCHAR(255), description VARCHAR(255), PRIMARY KEY(id), @@ -114,9 +114,7 @@ id int NOT NULL, lower NUMERIC NOT NULL, upper NUMERIC NOT NULL, - unit_id int NOT NULL, - PRIMARY KEY(id), - CONSTRAINT fk_depths_unit_id FOREIGN KEY (unit_id) REFERENCES units(id) + PRIMARY KEY(id) ); @@ -126,12 +124,10 @@ id int NOT NULL, river_id int NOT NULL, depth_id int NOT NULL, - unit_id int NOT NULL, description VARCHAR(256), PRIMARY KEY(id), CONSTRAINT fk_sd_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, - CONSTRAINT fk_sd_depth_id FOREIGN KEY (depth_id) REFERENCES depths(id), - CONSTRAINT fk_sd_unit_id FOREIGN KEY (unit_id) REFERENCES units(id) + CONSTRAINT fk_sd_depth_id FOREIGN KEY (depth_id) REFERENCES depths(id) ); @@ -141,6 +137,7 @@ id int NOT NULL, sediment_density_id int NOT NULL, station NUMERIC NOT NULL, + shore_offset NUMERIC, density NUMERIC NOT NULL, description VARCHAR(256), year int, @@ -287,10 +284,12 @@ name VARCHAR(256) NOT NULL, river_id int NOT NULL, station NUMERIC NOT NULL, - range_id int NOT NULL, + range_id int, measurement_type VARCHAR(64) NOT NULL, riverside VARCHAR(16), reference_gauge_id int, + -- store name of reference gauges here too, as not all are in gauges + reference_gauge_name VARCHAR(64), observation_timerange_id int, operator VARCHAR(64), description VARCHAR(512), @@ -298,8 +297,7 @@ CONSTRAINT fk_ms_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, CONSTRAINT fk_ms_range_id FOREIGN KEY (range_id) REFERENCES ranges(id) ON DELETE CASCADE, CONSTRAINT fk_ms_reference_gauge_id FOREIGN KEY (reference_gauge_id) REFERENCES gauges(id) ON DELETE CASCADE, - CONSTRAINT fk_ms_observation_timerange_id FOREIGN KEY (observation_timerange_id) REFERENCES time_intervals(id), - UNIQUE (river_id, station) + CONSTRAINT fk_ms_observation_timerange_id FOREIGN KEY (observation_timerange_id) REFERENCES time_intervals(id) ); @@ -319,15 +317,20 @@ CREATE SEQUENCE SQ_RELATION_VALUES_ID_SEQ; CREATE TABLE sq_relation_value ( - id int NOT NULL, - sq_relation_id int NOT NULL, - parameter VARCHAR(16) NOT NULL, - fraction VARCHAR(32) NOT NULL, - function VARCHAR(32) NOT NULL, - km NUMERIC NOT NULL, - a NUMERIC NOT NULL, - b NUMERIC NOT NULL, + id int NOT NULL, + sq_relation_id int NOT NULL, + measurement_station_id int NOT NULL, + parameter VARCHAR(1) NOT NULL, + a NUMERIC NOT NULL, + b NUMERIC NOT NULL, + qmax NUMERIC NOT NULL, + rsq NUMERIC, + ntot int, + noutl int, + cferguson NUMERIC, + cduan NUMERIC, PRIMARY KEY (id), - CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id) ON DELETE CASCADE + CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id) ON DELETE CASCADE, + CONSTRAINT fk_mstation_id FOREIGN KEY (measurement_station_id) REFERENCES measurement_station(id) ); COMMIT;