[Dive4elements-commits] [PATCH] trigger sequence of range IDs in DB as it is not used by hibernate only anymore

Wald Commits scm-commit at wald.intevation.org
Thu Mar 14 13:32:16 CET 2013


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1363264322 -3600
# Node ID 4f3cc1aebcc0d2d6fa748debf2b453bd42167209
# Parent  55122db34cd0d0f7632153cefb80f257a81e7714
trigger sequence of range IDs in DB as it is not used by hibernate only anymore

diff -r 55122db34cd0 -r 4f3cc1aebcc0 flys-backend/doc/schema/oracle.sql
--- 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
diff -r 55122db34cd0 -r 4f3cc1aebcc0 flys-backend/doc/schema/postgresql.sql
--- 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;


More information about the Dive4elements-commits mailing list