[Dive4elements-commits] [PATCH] Schema change: add constraint to discharge tables

Wald Commits scm-commit at wald.intevation.org
Tue Apr 30 12:53:14 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1367319190 -7200
# Node ID 4f35b34f4efafb7defa8c32258c9cf7b1e34bed4
# Parent  7100059790dfbbded9f37cf43b23e9a15b586db8
Schema change: add constraint to discharge tables

diff -r 7100059790df -r 4f35b34f4efa backend/doc/schema/oracle.sql
--- a/backend/doc/schema/oracle.sql	Tue Apr 30 11:14:58 2013 +0200
+++ b/backend/doc/schema/oracle.sql	Tue Apr 30 12:53:10 2013 +0200
@@ -96,7 +96,8 @@
     kind                NUMBER(38,0) NOT NULL DEFAULT 0,
     gauge_id            NUMBER(38,0) NOT NULL,
     time_interval_id    NUMBER(38,0),
-    PRIMARY KEY         (id)
+    PRIMARY KEY         (id),
+    UNIQUE(gauge_id, time_interval_id, kind)
 );
 
 
diff -r 7100059790df -r 4f35b34f4efa backend/doc/schema/postgresql.sql
--- a/backend/doc/schema/postgresql.sql	Tue Apr 30 11:14:58 2013 +0200
+++ b/backend/doc/schema/postgresql.sql	Tue Apr 30 12:53:10 2013 +0200
@@ -149,10 +149,8 @@
     description      VARCHAR(256) NOT NULL,
     bfg_id           VARCHAR(50),
     kind             int NOT NULL DEFAULT 0,
-    time_interval_id int REFERENCES time_intervals(id)
-
-    -- TODO: better checks
-    -- UNIQUE (gauge_id, kind, time_interval_id)
+    time_interval_id int REFERENCES time_intervals(id),
+    UNIQUE(gauge_id, time_interval_id, kind)
 );
 
 -- Values of the Abflusstafeln


More information about the Dive4elements-commits mailing list