changeset 5298:eaa630838705

trigger sequence of time_interval IDs in DB as it is not used by hibernate only anymore
author Tom Gottfried <tom@intevation.de>
date Thu, 14 Mar 2013 13:39:54 +0100
parents 4f3cc1aebcc0
children a82b621d87b0
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 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
--- 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;

http://dive4elements.wald.intevation.org