changeset 5158:a9658d43b621

added missing constraints in schema (mostly for Oracle)
author Tom Gottfried <tom@intevation.de>
date Fri, 01 Mar 2013 13:28:45 +0100
parents 6b19902baf31
children 074051942f92
files flys-backend/doc/schema/oracle-spatial.sql flys-backend/doc/schema/oracle.sql flys-backend/doc/schema/postgresql-spatial.sql
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle-spatial.sql	Fri Mar 01 12:40:15 2013 +0100
+++ b/flys-backend/doc/schema/oracle-spatial.sql	Fri Mar 01 13:28:45 2013 +0100
@@ -150,7 +150,7 @@
     border_break    NUMBER(1) DEFAULT 0 NOT NULL,
     resolution      VARCHAR(16),
     description     VARCHAR(256),
-    path            VARCHAR(256) NOT NULL
+    path            VARCHAR(256) NOT NULL UNIQUE
 );
 CREATE OR REPLACE TRIGGER dem_trigger BEFORE INSERT ON dem FOR each ROW
     BEGIN
--- a/flys-backend/doc/schema/oracle.sql	Fri Mar 01 12:40:15 2013 +0100
+++ b/flys-backend/doc/schema/oracle.sql	Fri Mar 01 13:28:45 2013 +0100
@@ -238,7 +238,7 @@
 
 CREATE TABLE ranges (
     id                  NUMBER(38,0) NOT NULL,
-    a                   NUMBER(38,10),
+    a                   NUMBER(38,10) NOT NULL,
     b                   NUMBER(38,10),
     river_id            NUMBER(38,0),
     PRIMARY KEY         (id)
@@ -261,11 +261,12 @@
 -- TIME_INTERVALS
 CREATE SEQUENCE TIME_INTERVALS_ID_SEQ;
 
-CREATE TABLE time_intervals (
+CREATE TABLE time_intervals_ (
     id                  NUMBER(38,0) NOT NULL, 
-    start_time          TIMESTAMP,
+    start_time          TIMESTAMP NOT NULL,
     stop_time           TIMESTAMP,
-    PRIMARY KEY         (id)
+    PRIMARY KEY         (id),
+    CHECK (start_time <= stop_time)
 );
 
 
--- a/flys-backend/doc/schema/postgresql-spatial.sql	Fri Mar 01 12:40:15 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-spatial.sql	Fri Mar 01 13:28:45 2013 +0100
@@ -107,7 +107,7 @@
     border_break    BOOLEAN NOT NULL DEFAULT FALSE,
     resolution      VARCHAR(16),
     description     VARCHAR(256),
-    path            VARCHAR(256) NOT NULL
+    path            VARCHAR(256) NOT NULL UNIQUE
 );
 ALTER TABLE dem ALTER COLUMN id SET DEFAULT NEXTVAL('DEM_ID_SEQ');
 

http://dive4elements.wald.intevation.org