[Dive4elements-commits] [PATCH] Schema change: Add missing constraints to cross sections in Oracle, cosmetics

Wald Commits scm-commit at wald.intevation.org
Thu May 16 16:14:32 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1368713668 -7200
# Node ID d12f920bbf0063d28b24699493b6d222dfc46903
# Parent  f9c5e1a8032d551e0f9b5a4c787e0307930c9987
Schema change: Add missing constraints to cross sections in Oracle, cosmetics

diff -r f9c5e1a8032d -r d12f920bbf00 backend/doc/schema/oracle.sql
--- a/backend/doc/schema/oracle.sql	Thu May 16 12:34:23 2013 +0200
+++ b/backend/doc/schema/oracle.sql	Thu May 16 16:14:28 2013 +0200
@@ -37,9 +37,10 @@
 
 CREATE TABLE cross_section_lines (
     id                  NUMBER(38,0) NOT NULL,
-    km                  NUMBER(38,2),
-    cross_section_id    NUMBER(38,0), 
-    PRIMARY KEY         (id)
+    km                  NUMBER(38,2) NOT NULL,
+    cross_section_id    NUMBER(38,0) NOT NULL, 
+    PRIMARY KEY         (id),
+    UNIQUE (km, cross_section_id)
 );
 
 
@@ -48,11 +49,12 @@
 
 CREATE TABLE cross_section_points (
     id                      NUMBER(38,0) NOT NULL,
-    col_pos                 NUMBER(38,0),
-    x                       NUMBER(38,2),
-    y                       NUMBER(38,2),
-    cross_section_line_id   NUMBER(38,0),
-    PRIMARY KEY             (id)
+    col_pos                 NUMBER(38,0) NOT NULL,
+    x                       NUMBER(38,2) NOT NULL,
+    y                       NUMBER(38,2) NOT NULL,
+    cross_section_line_id   NUMBER(38,0) NOT NULL,
+    PRIMARY KEY             (id),
+    UNIQUE (cross_section_line_id, col_pos)
 );
 
 
@@ -62,7 +64,7 @@
 CREATE TABLE cross_sections (
     id                  NUMBER(38,0) NOT NULL,
     description         VARCHAR2(255),
-    river_id            NUMBER(38,0),
+    river_id            NUMBER(38,0) NOT NULL,
     time_interval_id    NUMBER(38,0),
     PRIMARY KEY         (id)
 );
diff -r f9c5e1a8032d -r d12f920bbf00 backend/doc/schema/postgresql.sql
--- a/backend/doc/schema/postgresql.sql	Thu May 16 12:34:23 2013 +0200
+++ b/backend/doc/schema/postgresql.sql	Thu May 16 16:14:28 2013 +0200
@@ -293,8 +293,8 @@
 
 CREATE TABLE cross_sections (
     id               int PRIMARY KEY NOT NULL,
-    river_id         int             NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
-    time_interval_id int                      REFERENCES time_intervals(id),
+    river_id         int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
+    time_interval_id int REFERENCES time_intervals(id),
     description      VARCHAR(256)
 );
 


More information about the Dive4elements-commits mailing list