diff flys-backend/doc/schema/postgresql-minfo.sql @ 4193:f63b39799d2d

Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 22 Oct 2012 09:02:26 +0200
parents fc32a4955087
children 504cd5801785
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql-minfo.sql	Fri Oct 19 13:59:51 2012 +0200
+++ b/flys-backend/doc/schema/postgresql-minfo.sql	Mon Oct 22 09:02:26 2012 +0200
@@ -352,6 +352,28 @@
 );
 
 
+CREATE SEQUENCE MEASUREMENT_STATION_ID_SEQ;
+CREATE TABLE measurement_station (
+	id			             int          NOT NULL,
+	name		             VARCHAR(256) NOT NULL,
+	river_id                 int          NOT NULL,
+	station                  NUMERIC      NOT NULL,
+	range_id                 int          NOT NULL,
+	measurement_type         VARCHAR(64)  NOT NULL,
+	riverside                VARCHAR(16),
+	reference_gauge_id       int,
+	observation_timerange_id int,
+	operator				 VARCHAR(64),
+	comment					 VARCHAR(512),
+	PRIMARY KEY (id),
+	CONSTRAINT fk_ms_river_id FOREIGN KEY (river_id) REFERENCES rivers(id),
+	CONSTRAINT fk_ms_range_id FOREIGN KEY (range_id) REFERENCES ranges(id),
+	CONSTRAINT fk_ms_reference_gauge_id FOREIGN KEY (reference_gauge_id) REFERENCES gauges(id),
+	CONSTRAINT fk_ms_observation_timerange_id FOREIGN KEY (observation_timerange_id) REFERENCES time_intervals(id),
+	UNIQUE (river_id, station)
+);
+
+
 CREATE SEQUENCE SQ_RELATION_ID_SEQ;
 
 CREATE TABLE sq_relation (

http://dive4elements.wald.intevation.org