comparison 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
comparison
equal deleted inserted replaced
4192:34337e357a54 4193:f63b39799d2d
350 PRIMARY KEY (id), 350 PRIMARY KEY (id),
351 CONSTRAINT fk_wdv_column_id FOREIGN KEY (column_id) REFERENCES waterlevel_difference_column (id) 351 CONSTRAINT fk_wdv_column_id FOREIGN KEY (column_id) REFERENCES waterlevel_difference_column (id)
352 ); 352 );
353 353
354 354
355 CREATE SEQUENCE MEASUREMENT_STATION_ID_SEQ;
356 CREATE TABLE measurement_station (
357 id int NOT NULL,
358 name VARCHAR(256) NOT NULL,
359 river_id int NOT NULL,
360 station NUMERIC NOT NULL,
361 range_id int NOT NULL,
362 measurement_type VARCHAR(64) NOT NULL,
363 riverside VARCHAR(16),
364 reference_gauge_id int,
365 observation_timerange_id int,
366 operator VARCHAR(64),
367 comment VARCHAR(512),
368 PRIMARY KEY (id),
369 CONSTRAINT fk_ms_river_id FOREIGN KEY (river_id) REFERENCES rivers(id),
370 CONSTRAINT fk_ms_range_id FOREIGN KEY (range_id) REFERENCES ranges(id),
371 CONSTRAINT fk_ms_reference_gauge_id FOREIGN KEY (reference_gauge_id) REFERENCES gauges(id),
372 CONSTRAINT fk_ms_observation_timerange_id FOREIGN KEY (observation_timerange_id) REFERENCES time_intervals(id),
373 UNIQUE (river_id, station)
374 );
375
376
355 CREATE SEQUENCE SQ_RELATION_ID_SEQ; 377 CREATE SEQUENCE SQ_RELATION_ID_SEQ;
356 378
357 CREATE TABLE sq_relation ( 379 CREATE TABLE sq_relation (
358 id int NOT NULL, 380 id int NOT NULL,
359 river_id int NOT NULL, 381 river_id int NOT NULL,

http://dive4elements.wald.intevation.org