# HG changeset patch # User Tom Gottfried # Date 1364222781 -3600 # Node ID e88d55d01cf53cc44cb38f13d0bef2df9c2b2e07 # Parent 5ca06120b918db6784da19f415a5e3adab443adc SCHEMA CHANGE: additional columns and FK constraint for SQ-relation diff -r 5ca06120b918 -r e88d55d01cf5 flys-backend/doc/schema/oracle-drop-minfo.sql --- a/flys-backend/doc/schema/oracle-drop-minfo.sql Mon Mar 25 15:38:54 2013 +0100 +++ b/flys-backend/doc/schema/oracle-drop-minfo.sql Mon Mar 25 15:46:21 2013 +0100 @@ -40,6 +40,7 @@ ALTER TABLE sq_relation DROP CONSTRAINT fk_sqr_tinterval_id; ALTER TABLE sq_relation DROP CONSTRAINT fk_sqr_river_id; ALTER TABLE sq_relation_value DROP CONSTRAINT fk_sqr_id; +ALTER TABLE sq_relation_value DROP CONSTRAINT fk_mstation_id; ALTER TABLE measurement_station DROP CONSTRAINT fk_ms_river_id; ALTER TABLE measurement_station DROP CONSTRAINT fk_ms_range_id; ALTER TABLE measurement_station DROP CONSTRAINT fk_ms_reference_gauge_id; diff -r 5ca06120b918 -r e88d55d01cf5 flys-backend/doc/schema/oracle-minfo.sql --- a/flys-backend/doc/schema/oracle-minfo.sql Mon Mar 25 15:38:54 2013 +0100 +++ b/flys-backend/doc/schema/oracle-minfo.sql Mon Mar 25 15:46:21 2013 +0100 @@ -321,12 +321,18 @@ CREATE TABLE sq_relation_value ( id NUMBER(38,0) NOT NULL, sq_relation_id NUMBER(38,0) NOT NULL, + m_station_id NUMBER(38,0) NOT NULL, parameter VARCHAR(16) NOT NULL, fraction VARCHAR(32) NOT NULL, - function VARCHAR(32) NOT NULL, - km NUMBER(38,3) NOT NULL, - a NUMBER(38, 3) NOT NULL, - b NUMBER(38,3) NOT NULL, + a NUMBER(38,20) NOT NULL, + b NUMBER(38,20) NOT NULL, + q_max NUMBER(38,20), + r_sq NUMBER(38,3), + n_tot NUMBER(38,0), + n_outl NUMBER(38,0), + cferguson NUMBER(38,20), + cduan NUMBER(38,20), PRIMARY KEY (id), - CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id) + CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id), + CONSTRAINT fk_mstation_id FOREIGN KEY (m_station_id) REFERENCES measurement_station(id) ); diff -r 5ca06120b918 -r e88d55d01cf5 flys-backend/doc/schema/postgresql-minfo.sql --- a/flys-backend/doc/schema/postgresql-minfo.sql Mon Mar 25 15:38:54 2013 +0100 +++ b/flys-backend/doc/schema/postgresql-minfo.sql Mon Mar 25 15:46:21 2013 +0100 @@ -321,13 +321,19 @@ CREATE TABLE sq_relation_value ( id int NOT NULL, sq_relation_id int NOT NULL, + m_station_id int NOT NULL, parameter VARCHAR(16) NOT NULL, fraction VARCHAR(32) NOT NULL, - function VARCHAR(32) NOT NULL, - km NUMERIC NOT NULL, a NUMERIC NOT NULL, b NUMERIC NOT NULL, + q_max NUMERIC, + r_sq NUMERIC, + n_tot int, + n_outl int, + cferguson NUMERIC, + cduan NUMERIC, PRIMARY KEY (id), - CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id) ON DELETE CASCADE + CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id) ON DELETE CASCADE, + CONSTRAINT fk_mstation_id FOREIGN KEY (m_station_id) REFERENCES measurement_station(id) ); COMMIT;