changeset 5206:8667f629d238

SCHEME CHANGE: Add measurement_station to oracle table and rename comment column Comment is a reserved keyword in oracle. This also fixes a typo in the table name of time_intervals.
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 08 Mar 2013 15:16:00 +0100
parents 31fd42400c84
children 2919cdc4e858
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/src/main/java/de/intevation/flys/model/MeasurementStation.java
diffstat 5 files changed, 53 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle-drop-minfo.sql	Fri Mar 08 13:06:40 2013 +0100
+++ b/flys-backend/doc/schema/oracle-drop-minfo.sql	Fri Mar 08 15:16:00 2013 +0100
@@ -42,6 +42,10 @@
 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 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;
+ALTER TABLE measurement_station DROP CONSTRAINT fk_ms_observation_timerange_id;
 
 DROP TABLE bed_height_type;
 DROP TABLE location_system;
@@ -69,6 +73,7 @@
 DROP TABLE waterlevel_difference;
 DROP TABLE waterlevel_difference_column;
 DROP TABLE waterlevel_difference_values;
+DROP TABLE measurement_station;
 DROP TABLE sq_relation_value;
 DROP TABLE sq_relation;
 
--- a/flys-backend/doc/schema/oracle-minfo.sql	Fri Mar 08 13:06:40 2013 +0100
+++ b/flys-backend/doc/schema/oracle-minfo.sql	Fri Mar 08 15:16:00 2013 +0100
@@ -353,6 +353,28 @@
 );
 
 
+CREATE SEQUENCE MEASUREMENT_STATION_ID_SEQ;
+CREATE TABLE measurement_station (
+    id                       NUMBER(38)   NOT NULL,
+    name                     VARCHAR(256) NOT NULL,
+    river_id                 NUMBER(38)   NOT NULL,
+    station                  NUMBER(38,3) NOT NULL,
+    range_id                 NUMBER(38)   NOT NULL,
+    measurement_type         VARCHAR(64)  NOT NULL,
+    riverside                VARCHAR(16),
+    reference_gauge_id       NUMBER(38),
+    observation_timerange_id NUMBER(38),
+    operator                 VARCHAR(64),
+    description              VARCHAR(512),
+    PRIMARY KEY              (id),
+    CONSTRAINT fk_ms_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
+    CONSTRAINT fk_ms_range_id FOREIGN KEY (range_id) REFERENCES ranges(id) ON DELETE CASCADE,
+    CONSTRAINT fk_ms_reference_gauge_id FOREIGN KEY (reference_gauge_id) REFERENCES gauges(id) ON DELETE CASCADE,
+    CONSTRAINT fk_ms_observation_timerange_id FOREIGN KEY (observation_timerange_id) REFERENCES time_intervals(id),
+    UNIQUE (river_id, station)
+);
+
+
 CREATE SEQUENCE SQ_RELATION_ID_SEQ;
 
 CREATE TABLE sq_relation (
--- a/flys-backend/doc/schema/oracle.sql	Fri Mar 08 13:06:40 2013 +0100
+++ b/flys-backend/doc/schema/oracle.sql	Fri Mar 08 15:16:00 2013 +0100
@@ -261,7 +261,7 @@
 -- TIME_INTERVALS
 CREATE SEQUENCE TIME_INTERVALS_ID_SEQ;
 
-CREATE TABLE time_intervals_ (
+CREATE TABLE time_intervals (
     id                  NUMBER(38,0) NOT NULL, 
     start_time          TIMESTAMP NOT NULL,
     stop_time           TIMESTAMP,
--- a/flys-backend/doc/schema/postgresql-minfo.sql	Fri Mar 08 13:06:40 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-minfo.sql	Fri Mar 08 15:16:00 2013 +0100
@@ -285,23 +285,23 @@
 
 CREATE SEQUENCE MEASUREMENT_STATION_ID_SEQ;
 CREATE TABLE measurement_station (
-	id			             int          NOT NULL,
-	name		             VARCHAR(256) NOT NULL,
-	river_id                 int          NOT NULL,
-	station                  NUMERIC      NOT NULL,
-	range_id                 int          NOT NULL,
-	measurement_type         VARCHAR(64)  NOT NULL,
-	riverside                VARCHAR(16),
-	reference_gauge_id       int,
-	observation_timerange_id int,
-	operator				 VARCHAR(64),
-	comment					 VARCHAR(512),
-	PRIMARY KEY (id),
-	CONSTRAINT fk_ms_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
-	CONSTRAINT fk_ms_range_id FOREIGN KEY (range_id) REFERENCES ranges(id) ON DELETE CASCADE,
-	CONSTRAINT fk_ms_reference_gauge_id FOREIGN KEY (reference_gauge_id) REFERENCES gauges(id) ON DELETE CASCADE,
-	CONSTRAINT fk_ms_observation_timerange_id FOREIGN KEY (observation_timerange_id) REFERENCES time_intervals(id),
-	UNIQUE (river_id, station)
+    id                       int          NOT NULL,
+    name                     VARCHAR(256) NOT NULL,
+    river_id                 int          NOT NULL,
+    station                  NUMERIC      NOT NULL,
+    range_id                 int          NOT NULL,
+    measurement_type         VARCHAR(64)  NOT NULL,
+    riverside                VARCHAR(16),
+    reference_gauge_id       int,
+    observation_timerange_id int,
+    operator                 VARCHAR(64),
+    description              VARCHAR(512),
+    PRIMARY KEY (id),
+    CONSTRAINT fk_ms_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE,
+    CONSTRAINT fk_ms_range_id FOREIGN KEY (range_id) REFERENCES ranges(id) ON DELETE CASCADE,
+    CONSTRAINT fk_ms_reference_gauge_id FOREIGN KEY (reference_gauge_id) REFERENCES gauges(id) ON DELETE CASCADE,
+    CONSTRAINT fk_ms_observation_timerange_id FOREIGN KEY (observation_timerange_id) REFERENCES time_intervals(id),
+    UNIQUE (river_id, station)
 );
 
 
--- a/flys-backend/src/main/java/de/intevation/flys/model/MeasurementStation.java	Fri Mar 08 13:06:40 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/MeasurementStation.java	Fri Mar 08 15:16:00 2013 +0100
@@ -21,7 +21,7 @@
     private String measurementType;
     private String riverside;
     private String operator;
-    private String comment;
+    private String description;
 
     private Double station;
     private Range range;
@@ -37,7 +37,7 @@
 
     public MeasurementStation(River river, String name, String measurementType,
         String riverside, Double station, Range range, Gauge gauge,
-        TimeInterval observationTimerange, String operator, String comment) {
+        TimeInterval observationTimerange, String operator, String description) {
         this.river = river;
         this.name = name;
         this.measurementType = measurementType;
@@ -47,7 +47,7 @@
         this.gauge = gauge;
         this.observationTimerange = observationTimerange;
         this.operator = operator;
-        this.comment = comment;
+        this.description = description;
     }
 
     @Id
@@ -147,13 +147,13 @@
         this.operator = operator;
     }
 
-    @Column(name = "comment")
-    public String getComment() {
-        return comment;
+    @Column(name = "description")
+    public String getDescription() {
+        return description;
     }
 
-    public void setComment(String comment) {
-        this.comment = comment;
+    public void setDescription(String description) {
+        this.description = description;
     }
 
 }

http://dive4elements.wald.intevation.org