diff backend/doc/schema/postgresql-minfo.sql @ 8559:6d8d7425a6b5

Bed heights are just bed heights since a while ('single' is obsolete).
author "Tom Gottfried <tom@intevation.de>"
date Mon, 16 Feb 2015 11:08:33 +0100
parents 3a0522f1a532
children 6fcf4717605f
line wrap: on
line diff
--- a/backend/doc/schema/postgresql-minfo.sql	Mon Feb 16 10:12:12 2015 +0100
+++ b/backend/doc/schema/postgresql-minfo.sql	Mon Feb 16 11:08:33 2015 +0100
@@ -35,9 +35,9 @@
 INSERT INTO bed_height_type VALUES (6, 'Modell');
 
 
-CREATE SEQUENCE BED_HEIGHT_SINGLE_ID_SEQ;
+CREATE SEQUENCE BED_HEIGHT_ID_SEQ;
 
-CREATE TABLE bed_height_single (
+CREATE TABLE bed_height (
     id                      int NOT NULL,
     river_id                int NOT NULL,
     year                    int,
@@ -50,28 +50,34 @@
     evaluation_by           VARCHAR(255),
     description             VARCHAR(255),
     PRIMARY KEY(id),
-    CONSTRAINT fk_bed_single_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
+    CONSTRAINT fk_bed_river_id FOREIGN KEY (river_id)
+        REFERENCES rivers(id) ON DELETE CASCADE,
     CONSTRAINT fk_type FOREIGN KEY (type_id) REFERENCES bed_height_type(id),
-    CONSTRAINT fk_location_system FOREIGN KEY (location_system_id) REFERENCES location_system(id),
-    CONSTRAINT fk_cur_elevation_model FOREIGN KEY (cur_elevation_model_id) REFERENCES elevation_model(id),
-    CONSTRAINT fk_old_elevation_model FOREIGN KEY (old_elevation_model_id) REFERENCES elevation_model(id),
-    CONSTRAINT fk_range FOREIGN KEY (range_id) REFERENCES ranges(id) ON DELETE CASCADE
+    CONSTRAINT fk_location_system FOREIGN KEY (location_system_id)
+        REFERENCES location_system(id),
+    CONSTRAINT fk_cur_elevation_model FOREIGN KEY (cur_elevation_model_id)
+        REFERENCES elevation_model(id),
+    CONSTRAINT fk_old_elevation_model FOREIGN KEY (old_elevation_model_id)
+        REFERENCES elevation_model(id),
+    CONSTRAINT fk_range FOREIGN KEY (range_id)
+        REFERENCES ranges(id) ON DELETE CASCADE
 );
 
 
-CREATE SEQUENCE BED_SINGLE_VALUES_ID_SEQ;
+CREATE SEQUENCE BED_HEIGHT_VALUES_ID_SEQ;
 
-CREATE TABLE bed_height_single_values (
+CREATE TABLE bed_height_values (
     id                      int NOT NULL,
-    bed_height_single_id    int NOT NULL,
+    bed_height_id    int NOT NULL,
     station                 NUMERIC NOT NULL,
     height                  NUMERIC,
     uncertainty             NUMERIC,
     data_gap                NUMERIC,
     sounding_width          NUMERIC,
     PRIMARY KEY(id),
-    UNIQUE (station, bed_height_single_id),
-    CONSTRAINT fk_bed_single_values_parent FOREIGN KEY (bed_height_single_id) REFERENCES bed_height_single(id) ON DELETE CASCADE
+    UNIQUE (station, bed_height_id),
+    CONSTRAINT fk_bed_values_parent FOREIGN KEY (bed_height_id)
+        REFERENCES bed_height(id) ON DELETE CASCADE
 );
 
 

http://dive4elements.wald.intevation.org