comparison flys-backend/doc/schema/postgresql.sql @ 5207:2919cdc4e858

corrected constraints on table gauges
author Tom Gottfried <tom@intevation.de>
date Fri, 08 Mar 2013 16:51:55 +0100
parents 646c154477fe
children 4f3cc1aebcc0
comparison
equal deleted inserted replaced
5206:8667f629d238 5207:2919cdc4e858
79 CREATE SEQUENCE GAUGES_ID_SEQ; 79 CREATE SEQUENCE GAUGES_ID_SEQ;
80 80
81 CREATE TABLE gauges ( 81 CREATE TABLE gauges (
82 id int PRIMARY KEY NOT NULL, 82 id int PRIMARY KEY NOT NULL,
83 name VARCHAR(256) NOT NULL, 83 name VARCHAR(256) NOT NULL,
84 -- remove river id here because range_id references river already
84 river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE, 85 river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
85 station NUMERIC NOT NULL UNIQUE, 86 station NUMERIC NOT NULL,
86 aeo NUMERIC NOT NULL, 87 aeo NUMERIC NOT NULL,
87 official_number int8 UNIQUE, 88 official_number int8 UNIQUE,
88 89
89 -- Pegelnullpunkt 90 -- Pegelnullpunkt
90 datum NUMERIC NOT NULL, 91 datum NUMERIC NOT NULL,
91 -- Streckengueltigkeit 92 -- Streckengueltigkeit
92 range_id int REFERENCES ranges (id) ON DELETE CASCADE, 93 range_id int NOT NULL REFERENCES ranges (id) ON DELETE CASCADE,
93 94
94 UNIQUE (name, river_id), 95 UNIQUE (name, river_id),
95 UNIQUE (river_id, station) 96 UNIQUE (river_id, station)
96 ); 97 );
97 98

http://dive4elements.wald.intevation.org