[Dive4elements-commits] [PATCH] SCHEMA CHANGE: add table for flood marks and missing DROPs for jetties
Wald Commits
scm-commit at wald.intevation.org
Mon Mar 25 17:51:39 CET 2013
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1364230293 -3600
# Node ID 8b29a94ebdd8425230a31da6d45096ab7eba805b
# Parent 91f5908c472af836a3f5b8209febb320f38b5e99
SCHEMA CHANGE: add table for flood marks and missing DROPs for jetties
diff -r 91f5908c472a -r 8b29a94ebdd8 flys-backend/doc/schema/oracle-drop-spatial.sql
--- a/flys-backend/doc/schema/oracle-drop-spatial.sql Mon Mar 25 17:01:07 2013 +0100
+++ b/flys-backend/doc/schema/oracle-drop-spatial.sql Mon Mar 25 17:51:33 2013 +0100
@@ -67,6 +67,16 @@
DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = 'GAUGE_LOCATION';
DROP SEQUENCE GAUGE_LOCATION_ID_SEQ;
+DROP TRIGGER jetties_trigger;
+DROP TABLE jetties;
+DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = 'JETTIES';
+DROP SEQUENCE JETTIES_ID_SEQ;
+
+DROP TRIGGER flood_marks_trigger;
+DROP TABLE flood_marks;
+DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = 'FLOOD_MARKS';
+DROP SEQUENCE FLOOD_MARKS_ID_SEQ;
+
DROP TABLE hws_kinds;
DROP TABLE sectie_kinds;
DROP TABLE sobek_kinds;
diff -r 91f5908c472a -r 8b29a94ebdd8 flys-backend/doc/schema/oracle-spatial.sql
--- a/flys-backend/doc/schema/oracle-spatial.sql Mon Mar 25 17:01:07 2013 +0100
+++ b/flys-backend/doc/schema/oracle-spatial.sql Mon Mar 25 17:51:33 2013 +0100
@@ -412,3 +412,22 @@
SELECT JETTIES_ID_SEQ.nextval INTO :new.id FROM dual;
END;
/
+
+CREATE SEQUENCE FLOOD_MARKS_ID_SEQ;
+CREATE TABLE flood_marks (
+ OGR_FID NUMBER(38),
+ GEOM MDSYS.SDO_GEOMETRY,
+ id NUMBER PRIMARY KEY NOT NULL,
+ river_id NUMBER(38) REFERENCES rivers(id) ON DELETE CASCADE,
+ path VARCHAR(256),
+ km NUMBER(7,3),
+ z NUMBER(38,12),
+ location VARCHAR(64),
+ year NUMBER(38,0)
+);
+INSERT INTO USER_SDO_GEOM_METADATA VALUES ('flood_marks', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',3282450,3912240,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5248260,6100130,0.001)), 31467);
+CREATE OR REPLACE TRIGGER flood_marks_trigger BEFORE INSERT ON flood_marks FOR EACH ROW
+ BEGIN
+ SELECT FLOOD_MARKS_ID_SEQ.nextval INTO :new.id FROM dual;
+ END;
+/
diff -r 91f5908c472a -r 8b29a94ebdd8 flys-backend/doc/schema/oracle-spatial_idx.sql
--- a/flys-backend/doc/schema/oracle-spatial_idx.sql Mon Mar 25 17:01:07 2013 +0100
+++ b/flys-backend/doc/schema/oracle-spatial_idx.sql Mon Mar 25 17:51:33 2013 +0100
@@ -22,3 +22,4 @@
CREATE INDEX jetties_idx ON jetties(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT');
+CREATE INDEX flood_marks_idx ON flood_marks(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT');
diff -r 91f5908c472a -r 8b29a94ebdd8 flys-backend/doc/schema/postgresql-spatial.sql
--- a/flys-backend/doc/schema/postgresql-spatial.sql Mon Mar 25 17:01:07 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-spatial.sql Mon Mar 25 17:51:33 2013 +0100
@@ -331,5 +331,17 @@
SELECT AddGeometryColumn('jetties','geom',31467,'POINT',2);
ALTER TABLE jetties ALTER COLUMN id SET DEFAULT NEXTVAL('JETTIES_ID_SEQ');
+CREATE SEQUENCE FLOOD_MARKS_ID_SEQ;
+CREATE TABLE flood_marks (
+ id int PRIMARY KEY NOT NULL,
+ river_id int REFERENCES rivers(id) ON DELETE CASCADE,
+ path VARCHAR(256),
+ km FLOAT8,
+ z FLOAT8,
+ location VARCHAR(64),
+ year int
+);
+SELECT AddGeometryColumn('flood_marks','geom',31467,'POINT',2);
+ALTER TABLE flood_marks ALTER COLUMN id SET DEFAULT NEXTVAL('FLOOD_MARKS_ID_SEQ');
COMMIT;
More information about the Dive4elements-commits
mailing list