[PATCH] SCHEMA CHANGE: a < b now enforced on ranges

Wald Commits scm-commit at wald.intevation.org
Thu Sep 12 21:13:02 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1379013179 -7200
# Branch double-precision
# Node ID dddf633fec055908c8212ca3c089df692ecdfb42
# Parent  bb5bd48b80f66e7c8bcd0ad252ec0534ed882b23
SCHEMA CHANGE: a < b now enforced on ranges.

diff -r bb5bd48b80f6 -r dddf633fec05 backend/doc/schema/oracle.sql
--- a/backend/doc/schema/oracle.sql	Thu Sep 12 19:15:07 2013 +0200
+++ b/backend/doc/schema/oracle.sql	Thu Sep 12 21:12:59 2013 +0200
@@ -251,7 +251,8 @@
     b                   NUMBER(38,10),
     river_id            NUMBER(38,0),
     UNIQUE (river_id, a, b),
-    PRIMARY KEY (id)
+    PRIMARY KEY (id),
+    CHECK (a < b)
 );
 
 
diff -r bb5bd48b80f6 -r dddf633fec05 backend/doc/schema/postgresql.sql
--- a/backend/doc/schema/postgresql.sql	Thu Sep 12 19:15:07 2013 +0200
+++ b/backend/doc/schema/postgresql.sql	Thu Sep 12 21:12:59 2013 +0200
@@ -34,7 +34,8 @@
     river_id int             NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
     a        NUMERIC         NOT NULL,
     b        NUMERIC,
-    UNIQUE (river_id, a, b)
+    UNIQUE (river_id, a, b),
+    CHECK (a < b)
 );
 
 


More information about the Dive4elements-commits mailing list