changeset 505:ce9c6f05f464

Schema: Added a column which tells if a river counts its km up or downwards. flys-backend/trunk@1894 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 11 May 2011 08:44:14 +0000
parents ee693b8fbb55
children e451b08343d3
files flys-backend/ChangeLog flys-backend/doc/schema/postgresql.sql flys-backend/src/main/java/de/intevation/flys/model/River.java
diffstat 3 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Tue May 10 17:31:10 2011 +0000
+++ b/flys-backend/ChangeLog	Wed May 11 08:44:14 2011 +0000
@@ -1,3 +1,14 @@
+2011-05-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/schema/postgresql.sql: Added a column which tells
+	  if a river counts its km up or downwards.
+	  To update existing databases:
+
+	    ALTER TABLE rivers ADD COLUMN km_up BOOLEAN NOT NULL DEFAULT true;
+
+	* src/main/java/de/intevation/flys/model/River.java:
+	  Adjust Hibernate mapping of new column.
+
 2011-05-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/importer/AtFileParser.java:
--- a/flys-backend/doc/schema/postgresql.sql	Tue May 10 17:31:10 2011 +0000
+++ b/flys-backend/doc/schema/postgresql.sql	Wed May 11 08:44:14 2011 +0000
@@ -4,8 +4,9 @@
 CREATE SEQUENCE RIVERS_ID_SEQ;
 
 CREATE TABLE rivers (
-    id   int PRIMARY KEY NOT NULL,
-    name VARCHAR(256)    NOT NULL UNIQUE
+    id    int PRIMARY KEY NOT NULL,
+    name  VARCHAR(256)    NOT NULL UNIQUE,
+    km_up BOOLEAN         NOT NULL DEFAULT true
 );
 
 -- Bruecke, Haefen, etc.
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java	Tue May 10 17:31:10 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java	Wed May 11 08:44:14 2011 +0000
@@ -31,6 +31,8 @@
 
     private String  name;
 
+    private boolean kmUp;
+
     private List<Gauge> gauges;
 
     @Id
@@ -59,6 +61,15 @@
         this.name = name;
     }
 
+    @Column(name = "km_up")
+    public boolean getKmUp() {
+        return kmUp;
+    }
+
+    public void setKmUp(boolean kmUp) {
+        this.kmUp = kmUp;
+    }
+
     public River() {
     }
 

http://dive4elements.wald.intevation.org