changeset 6030:d12f920bbf00

Schema change: Add missing constraints to cross sections in Oracle, cosmetics
author Tom Gottfried <tom@intevation.de>
date Thu, 16 May 2013 16:14:28 +0200 (2013-05-16)
parents f9c5e1a8032d
children cb4dee704555 2d16f4a0bdcc
files backend/doc/schema/oracle.sql backend/doc/schema/postgresql.sql
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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)
 );
--- 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)
 );
 

http://dive4elements.wald.intevation.org