diff backend/doc/schema/postgresql.sql @ 5894:62e6598a2c4b

Schema change: make gauges.official_number unique per river as we can have multiple identical gauges for different representations of the same river. Comments and TODOs
author Tom Gottfried <tom@intevation.de>
date Fri, 03 May 2013 10:31:34 +0200
parents c1abd48a03e2
children 4fafe8d147b2
line wrap: on
line diff
--- a/backend/doc/schema/postgresql.sql	Fri May 03 07:47:15 2013 +0200
+++ b/backend/doc/schema/postgresql.sql	Fri May 03 10:31:34 2013 +0200
@@ -86,7 +86,7 @@
     river_id        int             NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
     station         NUMERIC         NOT NULL,
     aeo             NUMERIC         NOT NULL,
-    official_number int8            UNIQUE,
+    official_number int8,
 
     -- Pegelnullpunkt
     datum    NUMERIC NOT NULL,
@@ -94,6 +94,7 @@
     range_id int NOT NULL REFERENCES ranges (id) ON DELETE CASCADE,
 
     UNIQUE (name, river_id),
+    UNIQUE (official_number, river_id),
     UNIQUE (river_id, station)
 );
 

http://dive4elements.wald.intevation.org