diff backend/doc/schema/postgresql-minfo.sql @ 8072:5f28aa1be795

SCHEMA CHANGE: rename database tables from yield to load_ls according to respective classes.
author Tom Gottfried <tom@intevation.de>
date Wed, 06 Aug 2014 19:17:12 +0200
parents bde5f5ec7c72
children 17db08570637
line wrap: on
line diff
--- a/backend/doc/schema/postgresql-minfo.sql	Tue Aug 05 18:28:04 2014 +0200
+++ b/backend/doc/schema/postgresql-minfo.sql	Wed Aug 06 19:17:12 2014 +0200
@@ -259,17 +259,17 @@
 INSERT INTO grain_fraction VALUES (9, 'suspended_load', 0, 2);
 
 
---lookup table for sediment yield kinds
-CREATE TABLE sediment_yield_kinds (
+--lookup table for sediment load kinds
+CREATE TABLE sediment_load_kinds (
     id 	     int PRIMARY KEY NOT NULL,
     kind     VARCHAR(64) NOT NULL
 );
-INSERT INTO sediment_yield_kinds (id, kind) VALUES (0, 'non-official');
-INSERT INTO sediment_yield_kinds (id, kind) VALUES (1, 'official');
+INSERT INTO sediment_load_kinds (id, kind) VALUES (0, 'non-official');
+INSERT INTO sediment_load_kinds (id, kind) VALUES (1, 'official');
 
-CREATE SEQUENCE SEDIMENT_YIELD_ID_SEQ;
+CREATE SEQUENCE SEDIMENT_LOAD_LS_ID_SEQ;
 
-CREATE TABLE sediment_yield (
+CREATE TABLE sediment_load_ls (
     id                  int NOT NULL,
     river_id            int NOT NULL,
     grain_fraction_id   int,
@@ -279,25 +279,31 @@
     description         VARCHAR(256),
     kind                int,
     PRIMARY KEY (id),
-    CONSTRAINT fk_sy_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
-    CONSTRAINT fk_sy_kind_id FOREIGN KEY (kind) REFERENCES sediment_yield_kinds(id),
-    CONSTRAINT fk_sy_grain_fraction_id FOREIGN KEY (grain_fraction_id) REFERENCES grain_fraction(id),
-    CONSTRAINT fk_sy_unit_id FOREIGN KEY (unit_id) REFERENCES units(id),
-    CONSTRAINT fk_sy_time_interval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id),
-    CONSTRAINT fk_sy_sq_time_interval_id FOREIGN KEY (sq_time_interval_id)
+    CONSTRAINT fk_slls_river_id FOREIGN KEY (river_id)
+        REFERENCES rivers(id) ON DELETE CASCADE,
+    CONSTRAINT fk_slls_kind_id FOREIGN KEY (kind)
+        REFERENCES sediment_load_kinds(id),
+    CONSTRAINT fk_slls_grain_fraction_id FOREIGN KEY (grain_fraction_id)
+        REFERENCES grain_fraction(id),
+    CONSTRAINT fk_slls_unit_id FOREIGN KEY (unit_id)
+        REFERENCES units(id),
+    CONSTRAINT fk_slls_time_interval_id FOREIGN KEY (time_interval_id)
+        REFERENCES time_intervals(id),
+    CONSTRAINT fk_slls_sq_time_interval_id FOREIGN KEY (sq_time_interval_id)
         REFERENCES time_intervals(id)
 );
 
 
-CREATE SEQUENCE SEDIMENT_YIELD_VALUES_ID_SEQ;
+CREATE SEQUENCE SEDIMENT_LOAD_LS_VALUES_ID_SEQ;
 
-CREATE TABLE sediment_yield_values (
+CREATE TABLE sediment_load_ls_values (
     id                  int NOT NULL,
-    sediment_yield_id   int NOT NULL,
+    sediment_load_ls_id   int NOT NULL,
     station             NUMERIC NOT NULL,
     value               NUMERIC NOT NULL,
     PRIMARY KEY (id),
-    CONSTRAINT fk_syv_sediment_yield_id FOREIGN KEY (sediment_yield_id) REFERENCES sediment_yield(id) ON DELETE CASCADE
+    CONSTRAINT fk_sllsv_sediment_load_ls_id FOREIGN KEY (sediment_load_ls_id)
+        REFERENCES sediment_load_ls(id) ON DELETE CASCADE
 );
 
 
@@ -335,7 +341,7 @@
     kind                  int,
     PRIMARY KEY (id),
     CONSTRAINT fk_sl_kind_id FOREIGN KEY (kind)
-        REFERENCES sediment_yield_kinds(id),
+        REFERENCES sediment_load_kinds(id),
     CONSTRAINT fk_sl_grain_fraction_id FOREIGN KEY (grain_fraction_id)
         REFERENCES grain_fraction(id),
     CONSTRAINT fk_sl_time_interval_id FOREIGN KEY (time_interval_id) 

http://dive4elements.wald.intevation.org