changeset 5321:6dd354e7abfc

SCHEMA CHANGE: removed bad triggers and foreign keys from schema
author Tom Gottfried <tom@intevation.de>
date Fri, 15 Mar 2013 16:43:00 +0100
parents a7778435a4af
children 81ad2c717b9c
files flys-backend/doc/schema/oracle-drop-minfo.sql flys-backend/doc/schema/oracle-minfo.sql flys-backend/doc/schema/oracle.sql flys-backend/doc/schema/postgresql-minfo.sql flys-backend/doc/schema/postgresql.sql
diffstat 5 files changed, 1 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle-drop-minfo.sql	Fri Mar 15 11:04:13 2013 +0100
+++ b/flys-backend/doc/schema/oracle-drop-minfo.sql	Fri Mar 15 16:43:00 2013 +0100
@@ -20,12 +20,10 @@
 ALTER TABLE morphologic_width DROP CONSTRAINT fk_mw_unit_id;
 ALTER TABLE morphologic_width_values DROP CONSTRAINT fk_mwv_morphologic_width_id;
 ALTER TABLE flow_velocity_model_values DROP CONSTRAINT fk_fvv_flow_velocity_model_id;
-ALTER TABLE flow_velocity_model DROP CONSTRAINT fk_fvm_river_id;
 ALTER TABLE flow_velocity_model DROP CONSTRAINT fk_fvm_discharge_zone_id;
 ALTER TABLE discharge_zone DROP CONSTRAINT fk_dz_river_id;
 ALTER TABLE flow_velocity_measurements DROP CONSTRAINT fk_fvm_rivers_id;
 ALTER TABLE flow_velocity_measure_values DROP CONSTRAINT fk_fvmv_measurements_id;
-ALTER TABLE grain_fraction DROP CONSTRAINT fk_gf_unit_id;
 ALTER TABLE sediment_yield DROP CONSTRAINT fk_sy_grain_fraction_id;
 ALTER TABLE sediment_yield DROP CONSTRAINT fk_sy_unit_id;
 ALTER TABLE sediment_yield DROP CONSTRAINT fk_sy_time_interval_id;
--- a/flys-backend/doc/schema/oracle-minfo.sql	Fri Mar 15 11:04:13 2013 +0100
+++ b/flys-backend/doc/schema/oracle-minfo.sql	Fri Mar 15 16:43:00 2013 +0100
@@ -192,11 +192,9 @@
 
 CREATE TABLE flow_velocity_model (
     id                  NUMBER(38,0) NOT NULL,
-    river_id            NUMBER(38,0) NOT NULL,
     discharge_zone_id   NUMBER(38,0) NOT NULL,
     description         VARCHAR(256),
     PRIMARY KEY (id),
-    CONSTRAINT fk_fvm_river_id FOREIGN KEY (river_id) REFERENCES rivers(id),
     CONSTRAINT fk_fvm_discharge_zone_id FOREIGN KEY (discharge_zone_id) REFERENCES discharge_zone (id)
 );
 
@@ -250,9 +248,7 @@
     name    VARCHAR(64)    NOT NULL,
     lower   NUMBER(38,3),
     upper   NUMBER(38,3),
-    unit_id NUMBER(38,0),
     PRIMARY KEY (id),
-    CONSTRAINT fk_gf_unit_id FOREIGN KEY (unit_id) REFERENCES units(id)
 );
 
 
--- a/flys-backend/doc/schema/oracle.sql	Fri Mar 15 11:04:13 2013 +0100
+++ b/flys-backend/doc/schema/oracle.sql	Fri Mar 15 16:43:00 2013 +0100
@@ -246,11 +246,7 @@
     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
@@ -276,11 +272,6 @@
     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-minfo.sql	Fri Mar 15 11:04:13 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-minfo.sql	Fri Mar 15 16:43:00 2013 +0100
@@ -192,11 +192,9 @@
 
 CREATE TABLE flow_velocity_model (
     id                  int NOT NULL,
-    river_id            int NOT NULL,
     discharge_zone_id   int NOT NULL,
     description         VARCHAR(256),
     PRIMARY KEY (id),
-    CONSTRAINT fk_fvm_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
     CONSTRAINT fk_fvm_discharge_zone_id FOREIGN KEY (discharge_zone_id) REFERENCES discharge_zone (id) ON DELETE CASCADE
 );
 
@@ -250,9 +248,7 @@
     name    VARCHAR(64)    NOT NULL,
     lower   NUMERIC,
     upper   NUMERIC,
-    unit_id int,
     PRIMARY KEY (id),
-    CONSTRAINT fk_gf_unit_id FOREIGN KEY (unit_id) REFERENCES units(id)
 );
 
 
--- a/flys-backend/doc/schema/postgresql.sql	Fri Mar 15 11:04:13 2013 +0100
+++ b/flys-backend/doc/schema/postgresql.sql	Fri Mar 15 16:43:00 2013 +0100
@@ -36,7 +36,6 @@
     b        NUMERIC,
     UNIQUE (river_id, a, b)
 );
-ALTER TABLE ranges ALTER COLUMN id SET DEFAULT NEXTVAL('RANGES_ID_SEQ');
 
 
 -- Lage 'links', 'rechts', etc.
@@ -125,7 +124,6 @@
     stop_time  TIMESTAMP,
     CHECK (start_time <= stop_time)
 );
-ALTER TABLE time_intervals ALTER COLUMN id SET DEFAULT NEXTVAL('TIME_INTERVALS_ID_SEQ');
 
 
 -- Stammdaten

http://dive4elements.wald.intevation.org