# HG changeset patch # User Tom Gottfried # Date 1407345432 -7200 # Node ID 5f28aa1be795f1b9f5a257d639be0f62345d6966 # Parent 6e6506ec0ae00b55c996b157adfb5202c1be3213 SCHEMA CHANGE: rename database tables from yield to load_ls according to respective classes. diff -r 6e6506ec0ae0 -r 5f28aa1be795 artifacts/doc/conf/meta-data.xml --- a/artifacts/doc/conf/meta-data.xml Tue Aug 05 18:28:04 2014 +0200 +++ b/artifacts/doc/conf/meta-data.xml Wed Aug 06 19:17:12 2014 +0200 @@ -1486,7 +1486,7 @@ - + @@ -1495,9 +1495,9 @@ sy.description AS description, ti.start_time AS year, gf.name AS fraction - FROM sediment_yield sy + FROM sediment_load_ls sy JOIN rivers r ON sy.river_id = r.id - JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id + JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id JOIN time_intervals ti ON sy.time_interval_id = ti.id JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id WHERE r.id = ${river_id} @@ -1519,9 +1519,9 @@ ti.start_time AS startyear, ti.stop_time AS endyear, gf.name AS fraction - FROM sediment_yield sy + FROM sediment_load_ls sy JOIN rivers r ON sy.river_id = r.id - JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id + JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id JOIN time_intervals ti ON sy.time_interval_id = ti.id JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id WHERE r.id = ${river_id} @@ -1575,7 +1575,7 @@ - + diff -r 6e6506ec0ae0 -r 5f28aa1be795 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java Tue Aug 05 18:28:04 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java Wed Aug 06 19:17:12 2014 +0200 @@ -41,49 +41,49 @@ public static final String LOAD_DATA_CACHE_NAME = "sedimentload-data"; /** Query to get description and start year of single type - * sediment_yields. */ + * sediment_load_lss. */ public static final String SQL_SELECT_SINGLES = "SELECT DISTINCT " + " sy.description AS description, " + " ti.start_time AS year " + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN rivers r ON sy.river_id = r.id " + - " JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id " + + " JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id " + " JOIN time_intervals ti ON sy.time_interval_id = ti.id " + " WHERE r.name = :name " + " AND ti.stop_time IS NULL " + " AND syv.station BETWEEN :startKm AND :endKm"; - /** Query to get fraction name of single sediment_yield. */ + /** Query to get fraction name of single sediment_load_ls. */ public static final String SQL_SELECT_SINGLE_TIMES_BY_ID = "SELECT DISTINCT " + " ti.start_time AS starttime, " + " ti.stop_time AS stoptime " + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN time_intervals ti ON ti.id = sy.time_interval_id " + " WHERE sy.id = :id "; - /** Query to get fraction name of single sediment_yield. */ + /** Query to get fraction name of single sediment_load_ls. */ public static final String SQL_SELECT_SINGLE_FRACTION_BY_ID = "SELECT DISTINCT " + " gf.name AS fraction " + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN grain_fraction gf ON gf.id = grain_fraction_id " + " WHERE sy.id = :id "; - /** Query to get unit name of single sediment_yield. */ + /** Query to get unit name of single sediment_load_ls. */ public static final String SQL_SELECT_SINGLE_UNIT_BY_ID = "SELECT DISTINCT " + " u.name AS unit " + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN units u ON u.id = unit_id " + " WHERE sy.id = :id "; - /** Query to get description of single sediment_yield. */ + /** Query to get description of single sediment_load_ls. */ public static final String SQL_SELECT_SINGLE_BY_ID = "SELECT DISTINCT " + " sy.description AS description " + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " WHERE sy.id = :id "; /** Query to get description, name and time range for official @@ -92,9 +92,9 @@ "SELECT DISTINCT " + " ti.start_time AS startYear, " + " ti.stop_time AS end " + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN rivers r ON sy.river_id = r.id " + - " JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id " + + " JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id " + " JOIN time_intervals ti ON sy.time_interval_id = ti.id " + " WHERE r.name = :name " + " AND ti.stop_time IS NOT NULL " + @@ -109,9 +109,9 @@ " ti.start_time AS startYear, " + " ti.stop_time AS end, " + " u.name AS unit" + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN rivers r ON sy.river_id = r.id " + - " JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id " + + " JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id " + " JOIN time_intervals ti ON sy.time_interval_id = ti.id " + " JOIN units u ON u.id = sy.unit_id " + " WHERE r.name = :name " + @@ -126,8 +126,8 @@ " syv.station AS km, " + " u.name AS unit, " + " gf.name AS fraction " + - " FROM sediment_yield sy " + - " JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id " + + " FROM sediment_load_ls sy " + + " JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id " + " JOIN units u ON u.id = sy.unit_id" + " JOIN grain_fraction gf ON sy.grain_fraction_id = gf.id " + " WHERE sy.id = :id" + @@ -140,10 +140,10 @@ " syv.value AS load, " + " syv.station AS km, " + " u.name AS unit " + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN rivers r ON sy.river_id = r.id " + " JOIN time_intervals ti ON sy.time_interval_id = ti.id " + - " JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id " + + " JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id " + " JOIN grain_fraction gf ON sy.grain_fraction_id = gf.id " + " JOIN units u ON u.id = sy.unit_id" + " WHERE r.name = :name " + @@ -161,10 +161,10 @@ " syv.value AS load, " + " syv.station AS km, " + " u.name AS unit " + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN rivers r ON sy.river_id = r.id " + " JOIN time_intervals ti ON sy.time_interval_id = ti.id " + - " JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id " + + " JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id " + " JOIN grain_fraction gf ON sy.grain_fraction_id = gf.id " + " JOIN units u ON u.id = sy.unit_id" + " WHERE r.name = :name " + @@ -178,7 +178,7 @@ " sy.description AS description, " + " ti.start_time AS startYear, " + " ti.stop_time AS end " + - "FROM sediment_yield sy " + + "FROM sediment_load_ls sy " + " JOIN rivers r ON sy.river_id = r.id " + " JOIN time_intervals ti ON sy.time_interval_id = ti.id " + " JOIN grain_fraction gf ON sy.grain_fraction_id = gf.id " + @@ -196,10 +196,10 @@ " syv.station AS km," + " ti.stop_time AS endYear, " + " u.name AS unit" + - " FROM sediment_yield sy " + + " FROM sediment_load_ls sy " + " JOIN rivers r ON sy.river_id = r.id " + " JOIN time_intervals ti ON sy.time_interval_id = ti.id " + - " JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id " + + " JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id " + " JOIN grain_fraction gf ON sy.grain_fraction_id = gf.id " + " JOIN units u ON u.id = sy.unit_id " + " WHERE r.name = :name " + diff -r 6e6506ec0ae0 -r 5f28aa1be795 backend/doc/schema/oracle-drop-minfo.sql --- a/backend/doc/schema/oracle-drop-minfo.sql Tue Aug 05 18:28:04 2014 +0200 +++ b/backend/doc/schema/oracle-drop-minfo.sql Wed Aug 06 19:17:12 2014 +0200 @@ -22,11 +22,11 @@ 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 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; -ALTER TABLE sediment_yield DROP CONSTRAINT fk_sy_river_id; -ALTER TABLE sediment_yield_values DROP CONSTRAINT fk_syv_sediment_yield_id; +ALTER TABLE sediment_load_ls DROP CONSTRAINT fk_slls_grain_fraction_id; +ALTER TABLE sediment_load_ls DROP CONSTRAINT fk_slls_unit_id; +ALTER TABLE sediment_load_ls DROP CONSTRAINT fk_slls_time_interval_id; +ALTER TABLE sediment_load_ls DROP CONSTRAINT fk_slls_river_id; +ALTER TABLE sediment_load_ls_values DROP CONSTRAINT fk_sllsv_sediment_load_ls_id; ALTER TABLE sediment_load DROP CONSTRAINT fk_sl_kind_id; ALTER TABLE sediment_load DROP CONSTRAINT fk_sl_grain_fraction_id; ALTER TABLE sediment_load DROP CONSTRAINT fk_sl_time_interval_id; @@ -60,8 +60,8 @@ DROP TABLE flow_velocity_measurements PURGE; DROP TABLE flow_velocity_measure_values PURGE; DROP TABLE grain_fraction PURGE; -DROP TABLE sediment_yield PURGE; -DROP TABLE sediment_yield_values PURGE; +DROP TABLE sediment_load_ls PURGE; +DROP TABLE sediment_load_ls_values PURGE; DROP TABLE sediment_load PURGE; DROP TABLE sediment_load_values PURGE; DROP TABLE measurement_station PURGE; @@ -85,8 +85,8 @@ DROP SEQUENCE FV_MEASURE_ID_SEQ; DROP SEQUENCE FV_MEASURE_VALUES_ID_SEQ; DROP SEQUENCE GRAIN_FRACTION_ID_SEQ; -DROP SEQUENCE SEDIMENT_YIELD_ID_SEQ; -DROP SEQUENCE SEDIMENT_YIELD_VALUES_ID_SEQ; +DROP SEQUENCE SEDIMENT_LOAD_LS_ID_SEQ; +DROP SEQUENCE SEDIMENT_LOAD_LS_VALUES_ID_SEQ; DROP SEQUENCE SEDIMENT_LOAD_ID_SEQ; DROP SEQUENCE SEDIMENT_LOAD_VALUES_ID_SEQ; DROP SEQUENCE MEASUREMENT_STATION_ID_SEQ; diff -r 6e6506ec0ae0 -r 5f28aa1be795 backend/doc/schema/oracle-minfo.sql --- a/backend/doc/schema/oracle-minfo.sql Tue Aug 05 18:28:04 2014 +0200 +++ b/backend/doc/schema/oracle-minfo.sql Wed Aug 06 19:17:12 2014 +0200 @@ -260,16 +260,16 @@ --lookup table for sediment yield kinds -CREATE TABLE sediment_yield_kinds ( +CREATE TABLE sediment_load_kinds ( id int PRIMARY KEY NOT NULL, kind VARCHAR(64) NOT NULL ); -INSERT INTO sediment_yield_kinds (id, kind) VALUES (0, 'non-official'); -INSERT INTO sediment_yield_kinds (id, kind) VALUES (1, 'official'); +INSERT INTO sediment_load_kinds (id, kind) VALUES (0, 'non-official'); +INSERT INTO sediment_load_kinds (id, kind) VALUES (1, 'official'); -CREATE SEQUENCE SEDIMENT_YIELD_ID_SEQ; +CREATE SEQUENCE SEDIMENT_LOAD_LS_ID_SEQ; -CREATE TABLE sediment_yield ( +CREATE TABLE sediment_load_ls ( id NUMBER(38,0) NOT NULL, river_id NUMBER(38,0) NOT NULL, grain_fraction_id NUMBER(38,0), @@ -279,25 +279,31 @@ description VARCHAR(256), kind NUMBER(38,0), PRIMARY KEY (id), - CONSTRAINT fk_sy_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, - CONSTRAINT fk_sy_kind_id FOREIGN KEY (kind) REFERENCES sediment_yield_kinds(id), - CONSTRAINT fk_sy_grain_fraction_id FOREIGN KEY (grain_fraction_id) REFERENCES grain_fraction(id), - CONSTRAINT fk_sy_unit_id FOREIGN KEY (unit_id) REFERENCES units(id), - CONSTRAINT fk_sy_time_interval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id), - CONSTRAINT fk_sy_sq_time_interval_id FOREIGN KEY (sq_time_interval_id) + CONSTRAINT fk_slls_river_id FOREIGN KEY (river_id) + REFERENCES rivers(id) ON DELETE CASCADE, + CONSTRAINT fk_slls_kind_id FOREIGN KEY (kind) + REFERENCES sediment_load_kinds(id), + CONSTRAINT fk_slls_grain_fraction_id FOREIGN KEY (grain_fraction_id) + REFERENCES grain_fraction(id), + CONSTRAINT fk_slls_unit_id FOREIGN KEY (unit_id) + REFERENCES units(id), + CONSTRAINT fk_slls_time_interval_id FOREIGN KEY (time_interval_id) + REFERENCES time_intervals(id), + CONSTRAINT fk_slls_sq_time_interval_id FOREIGN KEY (sq_time_interval_id) REFERENCES time_intervals(id) ); -CREATE SEQUENCE SEDIMENT_YIELD_VALUES_ID_SEQ; +CREATE SEQUENCE SEDIMENT_LOAD_LS_VALUES_ID_SEQ; -CREATE TABLE sediment_yield_values ( +CREATE TABLE sediment_load_ls_values ( id NUMBER(38,0) NOT NULL, - sediment_yield_id NUMBER(38,0) NOT NULL, + sediment_load_ls_id NUMBER(38,0) NOT NULL, station NUMBER(38,3) NOT NULL, value NUMBER(38,3) NOT NULL, PRIMARY KEY (id), - CONSTRAINT fk_syv_sediment_yield_id FOREIGN KEY (sediment_yield_id) REFERENCES sediment_yield(id) ON DELETE CASCADE + CONSTRAINT fk_sllsv_sediment_load_ls_id FOREIGN KEY (sediment_load_ls_id) + REFERENCES sediment_load_ls(id) ON DELETE CASCADE ); @@ -335,7 +341,7 @@ kind int, PRIMARY KEY (id), CONSTRAINT fk_sl_kind_id FOREIGN KEY (kind) - REFERENCES sediment_yield_kinds(id), + REFERENCES sediment_load_kinds(id), CONSTRAINT fk_sl_grain_fraction_id FOREIGN KEY (grain_fraction_id) REFERENCES grain_fraction(id), CONSTRAINT fk_sl_time_interval_id FOREIGN KEY (time_interval_id) diff -r 6e6506ec0ae0 -r 5f28aa1be795 backend/doc/schema/postgresql-minfo.sql --- a/backend/doc/schema/postgresql-minfo.sql Tue Aug 05 18:28:04 2014 +0200 +++ b/backend/doc/schema/postgresql-minfo.sql Wed Aug 06 19:17:12 2014 +0200 @@ -259,17 +259,17 @@ INSERT INTO grain_fraction VALUES (9, 'suspended_load', 0, 2); ---lookup table for sediment yield kinds -CREATE TABLE sediment_yield_kinds ( +--lookup table for sediment load kinds +CREATE TABLE sediment_load_kinds ( id int PRIMARY KEY NOT NULL, kind VARCHAR(64) NOT NULL ); -INSERT INTO sediment_yield_kinds (id, kind) VALUES (0, 'non-official'); -INSERT INTO sediment_yield_kinds (id, kind) VALUES (1, 'official'); +INSERT INTO sediment_load_kinds (id, kind) VALUES (0, 'non-official'); +INSERT INTO sediment_load_kinds (id, kind) VALUES (1, 'official'); -CREATE SEQUENCE SEDIMENT_YIELD_ID_SEQ; +CREATE SEQUENCE SEDIMENT_LOAD_LS_ID_SEQ; -CREATE TABLE sediment_yield ( +CREATE TABLE sediment_load_ls ( id int NOT NULL, river_id int NOT NULL, grain_fraction_id int, @@ -279,25 +279,31 @@ description VARCHAR(256), kind int, PRIMARY KEY (id), - CONSTRAINT fk_sy_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, - CONSTRAINT fk_sy_kind_id FOREIGN KEY (kind) REFERENCES sediment_yield_kinds(id), - CONSTRAINT fk_sy_grain_fraction_id FOREIGN KEY (grain_fraction_id) REFERENCES grain_fraction(id), - CONSTRAINT fk_sy_unit_id FOREIGN KEY (unit_id) REFERENCES units(id), - CONSTRAINT fk_sy_time_interval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id), - CONSTRAINT fk_sy_sq_time_interval_id FOREIGN KEY (sq_time_interval_id) + CONSTRAINT fk_slls_river_id FOREIGN KEY (river_id) + REFERENCES rivers(id) ON DELETE CASCADE, + CONSTRAINT fk_slls_kind_id FOREIGN KEY (kind) + REFERENCES sediment_load_kinds(id), + CONSTRAINT fk_slls_grain_fraction_id FOREIGN KEY (grain_fraction_id) + REFERENCES grain_fraction(id), + CONSTRAINT fk_slls_unit_id FOREIGN KEY (unit_id) + REFERENCES units(id), + CONSTRAINT fk_slls_time_interval_id FOREIGN KEY (time_interval_id) + REFERENCES time_intervals(id), + CONSTRAINT fk_slls_sq_time_interval_id FOREIGN KEY (sq_time_interval_id) REFERENCES time_intervals(id) ); -CREATE SEQUENCE SEDIMENT_YIELD_VALUES_ID_SEQ; +CREATE SEQUENCE SEDIMENT_LOAD_LS_VALUES_ID_SEQ; -CREATE TABLE sediment_yield_values ( +CREATE TABLE sediment_load_ls_values ( id int NOT NULL, - sediment_yield_id int NOT NULL, + sediment_load_ls_id int NOT NULL, station NUMERIC NOT NULL, value NUMERIC NOT NULL, PRIMARY KEY (id), - CONSTRAINT fk_syv_sediment_yield_id FOREIGN KEY (sediment_yield_id) REFERENCES sediment_yield(id) ON DELETE CASCADE + CONSTRAINT fk_sllsv_sediment_load_ls_id FOREIGN KEY (sediment_load_ls_id) + REFERENCES sediment_load_ls(id) ON DELETE CASCADE ); @@ -335,7 +341,7 @@ kind int, PRIMARY KEY (id), CONSTRAINT fk_sl_kind_id FOREIGN KEY (kind) - REFERENCES sediment_yield_kinds(id), + REFERENCES sediment_load_kinds(id), CONSTRAINT fk_sl_grain_fraction_id FOREIGN KEY (grain_fraction_id) REFERENCES grain_fraction(id), CONSTRAINT fk_sl_time_interval_id FOREIGN KEY (time_interval_id) diff -r 6e6506ec0ae0 -r 5f28aa1be795 backend/src/main/java/org/dive4elements/river/model/SedimentLoadLS.java --- a/backend/src/main/java/org/dive4elements/river/model/SedimentLoadLS.java Tue Aug 05 18:28:04 2014 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/SedimentLoadLS.java Wed Aug 06 19:17:12 2014 +0200 @@ -26,7 +26,7 @@ /** SedimentLoadLS of a certain Fraction with possibly many values. */ @Entity -@Table(name = "sediment_yield") +@Table(name = "sediment_load_ls") public class SedimentLoadLS implements Serializable { @@ -89,12 +89,12 @@ @Id @SequenceGenerator( - name = "SEQUENCE_SEDIMENT_YIELD_ID_SEQ", - sequenceName = "SEDIMENT_YIELD_ID_SEQ", + name = "SEQUENCE_SEDIMENT_LOAD_LS_ID_SEQ", + sequenceName = "SEDIMENT_LOAD_LS_ID_SEQ", allocationSize = 1) @GeneratedValue( strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_SEDIMENT_YIELD_ID_SEQ") + generator = "SEQUENCE_SEDIMENT_LOAD_LS_ID_SEQ") @Column(name = "id") public Integer getId() { return id; @@ -174,7 +174,7 @@ } @OneToMany - @JoinColumn(name="sediment_yield_id") + @JoinColumn(name="sediment_load_ls_id") public List getSedimentLoadLSValues() { return values; } diff -r 6e6506ec0ae0 -r 5f28aa1be795 backend/src/main/java/org/dive4elements/river/model/SedimentLoadLSValue.java --- a/backend/src/main/java/org/dive4elements/river/model/SedimentLoadLSValue.java Tue Aug 05 18:28:04 2014 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/SedimentLoadLSValue.java Wed Aug 06 19:17:12 2014 +0200 @@ -24,7 +24,7 @@ @Entity -@Table(name = "sediment_yield_values") +@Table(name = "sediment_load_ls_values") public class SedimentLoadLSValue implements Serializable { @@ -53,12 +53,12 @@ @Id @SequenceGenerator( - name = "SEQUENCE_SEDIMENT_YIELD_VALuES_ID_SEQ", - sequenceName = "SEDIMENT_YIELD_VALUES_ID_SEQ", + name = "SEQUENCE_SEDIMENT_LOAD_LS_VALUES_ID_SEQ", + sequenceName = "SEDIMENT_LOAD_LS_VALUES_ID_SEQ", allocationSize = 1) @GeneratedValue( strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_SEDIMENT_YIELD_VALuES_ID_SEQ") + generator = "SEQUENCE_SEDIMENT_LOAD_LS_VALUES_ID_SEQ") @Column(name = "id") public Integer getId() { return id; @@ -69,7 +69,7 @@ } @OneToOne - @JoinColumn(name = "sediment_yield_id" ) + @JoinColumn(name = "sediment_load_ls_id" ) public SedimentLoadLS getSedimentLoadLS() { return sedimentLoadLS; }