diff flys-backend/doc/schema/postgresql-spatial.sql @ 5276:170f514a4f29

SCHEMA CHANGE: lookup table for floodmaps and source-field added, Importer adapted to new directory names
author Tom Gottfried <tom@intevation.de>
date Wed, 13 Mar 2013 18:39:28 +0100
parents b46df0609276
children f6478773a5bb 66d9389c80cb
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql-spatial.sql	Wed Mar 13 17:06:59 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-spatial.sql	Wed Mar 13 18:39:28 2013 +0100
@@ -208,25 +208,28 @@
 
 --
 --Hydrologie/UeSG
---
--- 'kind' can be one of:
--- 200 = Messung
--- 111 = Berechnung->Aktuell->BfG
--- 112 = Berechnung->Aktuell->Land
--- 121 = Berechnung->Potenziell->BfG
--- 122 = Berechnung->Potenziell->Land
---
+CREATE TABLE floodmap_kinds (
+    id 	     int PRIMARY KEY NOT NULL,
+    name     varchar(64) NOT NULL
+);
+INSERT INTO floodmap_kinds VALUES (200, 'Messung');
+INSERT INTO floodmap_kinds VALUES (111, 'Berechnung-Aktuell-BfG');
+INSERT INTO floodmap_kinds VALUES (112, 'Berechnung-Aktuell-Bundesländer');
+INSERT INTO floodmap_kinds VALUES (121, 'Berechnung-Potenziell-BfG');
+INSERT INTO floodmap_kinds VALUES (122, 'Berechnung-Potenziell-Bundesländer');
+
 CREATE SEQUENCE FLOODMAPS_ID_SEQ;
 CREATE TABLE floodmaps (
     id         int PRIMARY KEY NOT NULL,
     river_id   int REFERENCES rivers(id) ON DELETE CASCADE,
     name       varchar(64) NOT NULL,
-    kind       int NOT NULL,
+    kind       int NOT NULL REFERENCES floodmap_kinds(id),
     diff       FLOAT8,
     count      int,
     area       FLOAT8,
     perimeter  FLOAT8,
-    path     VARCHAR(256)
+    path     VARCHAR(256),
+    source   varchar(64)
 );
 SELECT AddGeometryColumn('floodmaps', 'geom', 31467, 'MULTIPOLYGON', 2);
 ALTER TABLE floodmaps DROP CONSTRAINT enforce_geotype_geom;

http://dive4elements.wald.intevation.org