changeset 2340:c4f090a00178

Added missing schemas. flys-backend/trunk@2818 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Schilberg <bjoern@intevation.de>
date Fri, 23 Sep 2011 11:15:20 +0000
parents b28ab244a77d
children 8e2fe935ddf1
files flys-backend/ChangeLog flys-backend/doc/schema/oracle-spatial.sql flys-backend/doc/schema/postgresql-spatial.sql
diffstat 3 files changed, 56 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Fri Sep 23 10:42:25 2011 +0000
+++ b/flys-backend/ChangeLog	Fri Sep 23 11:15:20 2011 +0000
@@ -1,3 +1,10 @@
+2011-09-23  Bjoern Schilberg <bjoern@intevation.de>
+
+	* doc/schema/postgresql-spatial.sql: 
+	  Added missing river_axes_km schema.
+	* doc/schema/oracle-spatial.sql:
+	  Added missing dem and lines schema.
+
 2011-09-22  Bjoern Schilberg <bjoern@intevation.de>
 
 	* doc/schema/postgresql-spatial.sql, doc/schema/oracle-spatial.sql:
--- a/flys-backend/doc/schema/oracle-spatial.sql	Fri Sep 23 10:42:25 2011 +0000
+++ b/flys-backend/doc/schema/oracle-spatial.sql	Fri Sep 23 11:15:20 2011 +0000
@@ -53,8 +53,29 @@
 --CREATE INDEX CrossSectionTracks_spatial_idx ON cross_section_tracks(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
 
 
--- TODO
--- Geodaesie/Linien/rohre-und-spreen
+-- TODO: TestMe. Fix Importer-Script. Fix oracle_spatial_idx.sql script.
+-- Geodaesie/Linien/rohre-und-speeren
+CREATE SEQUENCE LINES_ID_SEQ;
+CREATE TABLE lines (
+    OGR_FID NUMBER(38),
+    GEOM MDSYS.SDO_GEOMETRY,
+    river_id NUMBER(38),
+    kind     NUMBER(38) DEFAULT 0 NOT NULL,
+    z        NUMBER(38,12) DEFAULT 0,
+    ID NUMBER PRIMARY KEY NOT NULL
+);
+INSERT INTO USER_SDO_GEOM_METADATA VALUES ('lines', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2457864.326387,2634771.191263,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5297459.306295,5586961.449130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31466);
+CREATE OR REPLACE TRIGGER lines_trigger BEFORE INSERT ON lines FOR each ROW
+    BEGIN
+        SELECT LINES_ID_SEQ.nextval INTO :new.id FROM dual;
+    END;
+/
+-- NOTE: Should lines should be 3D.
+-- TODO: Test index. 
+--CREATE INDEX lines_idx ON lines(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE');
+-- 'kind':
+-- 0: ROHR1
+-- 1: DAMM
 
 
 -- Geodaesie/Bauwerke/Wehre.shp
@@ -113,8 +134,24 @@
 --CREATE INDEX floodplain_spatial_idx ON floodplain(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POLYGON');
 
 
--- TODO
+-- TODO: Test-Me. Fix Importer-Skript.
+-- NOTE: It's not a spatial schema!
 -- Geodaesie/Hoehenmodelle/*
+CREATE SEQUENCE DEM_ID_SEQ;
+CREATE TABLE dem (
+    ID NUMBER PRIMARY KEY NOT NULL,
+    river_id NUMBER(38),
+    -- XXX Should we use the ranges table instead?
+    lower    NUMBER(38),
+    upper    NUMBER(38),
+    path     VARCHAR(256),
+    UNIQUE (river_id, lower, upper)
+);
+CREATE OR REPLACE TRIGGER dem_trigger BEFORE INSERT ON dem FOR each ROW
+    BEGIN
+        SELECT DEM_ID_SEQ.nextval INTO :new.id FROM dual;
+    END;
+/
 
 
 -- Hydrologie/Einzugsgebiete/EZG.shp
--- a/flys-backend/doc/schema/postgresql-spatial.sql	Fri Sep 23 10:42:25 2011 +0000
+++ b/flys-backend/doc/schema/postgresql-spatial.sql	Fri Sep 23 11:15:20 2011 +0000
@@ -11,8 +11,16 @@
 ALTER TABLE river_axes ALTER COLUMN id SET DEFAULT NEXTVAL('RIVER_AXES_ID_SEQ');
 
 
--- TODO
+-- TODO: TestMe.
 -- Geodaesie/Flussachse+km/km.shp
+CREATE SEQUENCE RIVER_AXES_KM_ID_SEQ;
+CREATE TABLE river_axes_km (
+    id       int PRIMARY KEY NOT NULL,
+    river_id int REFERENCES rivers(id),
+    km       NUMERIC NOT NULL
+);
+SELECT AddGeometryColumn('river_axes_km', 'geom', 31466, 'POINT', 2);
+ALTER TABLE river_axes_km ALTER COLUMN id SET DEFAULT NEXTVAL('RIVER_AXES_KM_ID_SEQ');
 
 
 --Geodaesie/Querprofile/QP-Spuren/qps.shp

http://dive4elements.wald.intevation.org