diff 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
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql.sql	Fri Mar 08 15:16:00 2013 +0100
+++ b/flys-backend/doc/schema/postgresql.sql	Fri Mar 08 16:51:55 2013 +0100
@@ -81,15 +81,16 @@
 CREATE TABLE gauges (
     id              int PRIMARY KEY NOT NULL,
     name            VARCHAR(256)    NOT NULL,
+    -- remove river id here because range_id references river already
     river_id        int             NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
-    station         NUMERIC         NOT NULL UNIQUE,
+    station         NUMERIC         NOT NULL,
     aeo             NUMERIC         NOT NULL,
-    official_number int8                     UNIQUE,
+    official_number int8            UNIQUE,
 
     -- Pegelnullpunkt
     datum    NUMERIC NOT NULL,
     -- Streckengueltigkeit
-    range_id int REFERENCES ranges (id) ON DELETE CASCADE,
+    range_id int NOT NULL REFERENCES ranges (id) ON DELETE CASCADE,
 
     UNIQUE (name, river_id),
     UNIQUE (river_id, station)

http://dive4elements.wald.intevation.org