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

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


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

diff -r 4f3cc1aebcc0 -r eaa630838705 flys-backend/doc/schema/oracle.sql
--- a/flys-backend/doc/schema/oracle.sql	Thu Mar 14 13:32:02 2013 +0100
+++ b/flys-backend/doc/schema/oracle.sql	Thu Mar 14 13:39:54 2013 +0100
@@ -276,6 +276,11 @@
     PRIMARY KEY         (id),
     CHECK (start_time <= stop_time)
 );
+CREATE OR REPLACE TRIGGER time_intervals_trigger BEFORE INSERT ON time_intervals FOR EACH ROW
+    BEGIN
+        SELECT TIME_INTERVALS_ID_SEQ.nextval INTO :new.id FROM dual;
+    END;
+/
 
 
 --- UNITS
diff -r 4f3cc1aebcc0 -r eaa630838705 flys-backend/doc/schema/postgresql.sql
--- a/flys-backend/doc/schema/postgresql.sql	Thu Mar 14 13:32:02 2013 +0100
+++ b/flys-backend/doc/schema/postgresql.sql	Thu Mar 14 13:39:54 2013 +0100
@@ -125,6 +125,8 @@
     stop_time  TIMESTAMP,
     CHECK (start_time <= stop_time)
 );
+ALTER TABLE time_intervals ALTER COLUMN id SET DEFAULT NEXTVAL('TIME_INTERVALS_ID_SEQ');
+
 
 -- Stammdaten
 CREATE SEQUENCE MAIN_VALUES_ID_SEQ;


More information about the Dive4elements-commits mailing list