Mercurial > dive4elements > river
diff backend/doc/schema/postgresql-minfo.sql @ 8412:17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 15 Oct 2014 19:20:26 +0200 |
parents | 5f28aa1be795 |
children | ffbeffe2d266 |
line wrap: on
line diff
--- a/backend/doc/schema/postgresql-minfo.sql Wed Oct 15 14:58:46 2014 +0200 +++ b/backend/doc/schema/postgresql-minfo.sql Wed Oct 15 19:20:26 2014 +0200 @@ -310,23 +310,23 @@ CREATE SEQUENCE MEASUREMENT_STATION_ID_SEQ; CREATE TABLE measurement_station ( id int NOT NULL, + range_id int NOT NULL, + reference_gauge_id int, + time_interval_id int, name VARCHAR(256) NOT NULL, - river_id int NOT NULL, - station NUMERIC 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), + comment VARCHAR(512), PRIMARY KEY (id), - 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) + 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_time_interval_id FOREIGN KEY (time_interval_id) + REFERENCES time_intervals(id) ); @@ -374,8 +374,10 @@ time_interval_id int NOT NULL, description VARCHAR(256), PRIMARY KEY (id), - CONSTRAINT fk_sqr_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, - CONSTRAINT fk_sqr_tinterval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id) + CONSTRAINT fk_sqr_river_id FOREIGN KEY (river_id) + REFERENCES rivers(id) ON DELETE CASCADE, + CONSTRAINT fk_sqr_tinterval_id FOREIGN KEY (time_interval_id) + REFERENCES time_intervals(id) ); @@ -395,7 +397,9 @@ 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_mstation_id FOREIGN KEY (measurement_station_id) REFERENCES measurement_station(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) ON DELETE CASCADE ); COMMIT;