[Dive4elements-commits] [PATCH] corrected constraints on table gauges
Wald Commits
scm-commit at wald.intevation.org
Fri Mar 8 16:52:11 CET 2013
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1362757915 -3600
# Node ID 2919cdc4e8586e3743b0d845ef947e739688ae66
# Parent 8667f629d23843872c8cf68bb91683a93ea61089
corrected constraints on table gauges
diff -r 8667f629d238 -r 2919cdc4e858 flys-backend/doc/schema/oracle.sql
--- a/flys-backend/doc/schema/oracle.sql Fri Mar 08 15:16:00 2013 +0100
+++ b/flys-backend/doc/schema/oracle.sql Fri Mar 08 16:51:55 2013 +0100
@@ -115,14 +115,17 @@
CREATE TABLE gauges (
id NUMBER(38,0) NOT NULL,
- aeo NUMBER(38,2),
- datum NUMBER(38,2),
- name VARCHAR2(255),
- station NUMBER(38,2),
- official_number NUMBER(38,0),
- range_id NUMBER(38,0),
+ aeo NUMBER(38,2) NOT NULL,
+ datum NUMBER(38,2) NOT NULL,
+ name VARCHAR2(255) NOT NULL,
+ station NUMBER(38,2) NOT NULL,
+ official_number NUMBER(38,0) UNIQUE,
+ range_id NUMBER(38,0) NOT NULL,
+ -- remove river id here because range_id references river already
river_id NUMBER(38,0),
- PRIMARY KEY (id)
+ PRIMARY KEY (id),
+ UNIQUE (name, river_id),
+ UNIQUE (river_id, station)
);
diff -r 8667f629d238 -r 2919cdc4e858 flys-backend/doc/schema/postgresql.sql
--- a/flys-backend/doc/schema/postgresql.sql Fri Mar 08 15:16:00 2013 +0100
+++ b/flys-backend/doc/schema/postgresql.sql Fri Mar 08 16:51:55 2013 +0100
@@ -81,15 +81,16 @@
CREATE TABLE gauges (
id int PRIMARY KEY NOT NULL,
name VARCHAR(256) NOT NULL,
+ -- remove river id here because range_id references river already
river_id int NOT NULL REFERENCES rivers(id) ON DELETE CASCADE,
- station NUMERIC NOT NULL UNIQUE,
+ station NUMERIC NOT NULL,
aeo NUMERIC NOT NULL,
- official_number int8 UNIQUE,
+ official_number int8 UNIQUE,
-- Pegelnullpunkt
datum NUMERIC NOT NULL,
-- Streckengueltigkeit
- range_id int REFERENCES ranges (id) ON DELETE CASCADE,
+ range_id int NOT NULL REFERENCES ranges (id) ON DELETE CASCADE,
UNIQUE (name, river_id),
UNIQUE (river_id, station)
More information about the Dive4elements-commits
mailing list