changeset 5297:4f3cc1aebcc0

trigger sequence of range IDs in DB as it is not used by hibernate only anymore
author Tom Gottfried <tom@intevation.de>
date Thu, 14 Mar 2013 13:32:02 +0100
parents 55122db34cd0
children eaa630838705
files flys-backend/doc/schema/oracle.sql flys-backend/doc/schema/postgresql.sql
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle.sql	Thu Mar 14 12:53:36 2013 +0100
+++ b/flys-backend/doc/schema/oracle.sql	Thu Mar 14 13:32:02 2013 +0100
@@ -246,6 +246,11 @@
     river_id            NUMBER(38,0),
     PRIMARY KEY         (id)
 );
+CREATE OR REPLACE TRIGGER ranges_trigger BEFORE INSERT ON ranges FOR EACH ROW
+    BEGIN
+        SELECT RANGES_ID_SEQ.nextval INTO :new.id FROM dual;
+    END;
+/
 
 
 -- RIVERS
--- a/flys-backend/doc/schema/postgresql.sql	Thu Mar 14 12:53:36 2013 +0100
+++ b/flys-backend/doc/schema/postgresql.sql	Thu Mar 14 13:32:02 2013 +0100
@@ -36,6 +36,8 @@
     b        NUMERIC,
     UNIQUE (river_id, a, b)
 );
+ALTER TABLE ranges ALTER COLUMN id SET DEFAULT NEXTVAL('RANGES_ID_SEQ');
+
 
 -- Lage 'links', 'rechts', etc.
 CREATE SEQUENCE POSITIONS_ID_SEQ;

http://dive4elements.wald.intevation.org