diff flys-backend/doc/schema/oracle-spatial.sql @ 2796:f3b4e32b5db6

Improved the db schema for storing existing floodmaps. flys-backend/trunk@4125 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 06 Mar 2012 11:54:41 +0000
parents 7d378970d764
children efb10ed2af96
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle-spatial.sql	Tue Mar 06 07:45:30 2012 +0000
+++ b/flys-backend/doc/schema/oracle-spatial.sql	Tue Mar 06 11:54:41 2012 +0000
@@ -190,3 +190,48 @@
     END;
 /
 --CREATE INDEX hws_spatial_idx ON hws(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
+
+
+--Hydrologie/UeSG
+CREATE SEQUENCE FLOODMAPS_ID_SEQ;
+CREATE TABLE floodmaps (
+    id NUMBER PRIMARY KEY NOT NULL,
+    river_id NUMBER(38),
+    kind NUMBER(38),
+    diff NUMBER(19,5),
+    count NUMBER(38),
+    area NUMBER(19,5),
+    perimeter NUMBER(19,5)
+);
+CREATE OR REPLACE TRIGGER floodmaps_trigger BEFORE INSERT ON floodmaps FOR each ROW
+    BEGIN
+        SELECT FLOODMAPS_ID_SEQ.nextval INTO :new.id FROM dual;
+    END;
+/
+
+
+CREATE SEQUENCE FLOODMAP_GEOMS_SEQ;
+CREATE TABLE floodmap_geoms (
+    id           NUMBER(38) PRIMARY KEY NOT NULL,
+    floodmaps_id NUMBER(38) NOT NULL,
+    polygons_id  NUMBER(38) NOT NULL
+);
+CREATE OR REPLACE TRIGGER floodmap_geoms_trigger BEFORE INSERT ON floodmap_geoms FOR each ROW
+    BEGIN
+        SELECT FLOODMAP_GEOMS_SEQ.nextval INTO :new.id FROM dual;
+    END;
+/
+
+
+CREATE SEQUENCE POLYGONS_SEQ;
+CREATE TABLE polygons (
+    OGR_FID NUMBER(38),
+    GEOM MDSYS.SDO_GEOMETRY,
+    id NUMBER(38) PRIMARY KEY NOT NULL
+);
+INSERT INTO USER_SDO_GEOM_METADATA VALUES ('polygons', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',3282450,3912240,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5248260,6100130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31467);
+CREATE OR REPLACE TRIGGER polygons_trigger BEFORE INSERT ON polygons FOR each ROW
+    BEGIN
+        SELECT POLYGONS_SEQ.nextval INTO :new.id FROM dual;
+    END;
+/

http://dive4elements.wald.intevation.org