# HG changeset patch # User Sascha L. Teichmann # Date 1310740392 0 # Node ID dd948530fd573225653e36bfc7e0ef58f997af3f # Parent f08fe480092c2178d1c42e2464707f4c16bb34aa Schema: Added missing columns in HYK tables. flys-backend/trunk@2338 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r f08fe480092c -r dd948530fd57 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Fri Jul 15 13:07:45 2011 +0000 +++ b/flys-backend/ChangeLog Fri Jul 15 14:33:12 2011 +0000 @@ -1,3 +1,17 @@ +2011-07-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added missing columns. + To update existing databases: + BEGIN; + ALTER TABLE hyks ADD COLUMN measure TIMESTAMP; + ALTER TABLE hyk_entries ADD COLUMN distance_vl NUMERIC NOT NULL; + ALTER TABLE hyk_entries ADD COLUMN distance_hf NUMERIC NOT NULL; + ALTER TABLE hyk_entries ADD COLUMN distance_vr NUMERIC NOT NULL; + COMMIT; + * src/main/java/de/intevation/flys/model/HYKEntry.java, + src/main/java/de/intevation/flys/model/HYK.java: + Adjusted Hibernate models. + 2011-07-15 Sascha L. Teichmann * src/main/java/de/intevation/flys/importer/parsers/*.java: diff -r f08fe480092c -r dd948530fd57 flys-backend/doc/schema/postgresql.sql --- a/flys-backend/doc/schema/postgresql.sql Fri Jul 15 13:07:45 2011 +0000 +++ b/flys-backend/doc/schema/postgresql.sql Fri Jul 15 14:33:12 2011 +0000 @@ -298,15 +298,19 @@ CREATE TABLE hyks ( id int PRIMARY KEY NOT NULL, river_id int NOT NULL, + measure TIMESTAMP, description VARCHAR(256) NOT NULL ); CREATE SEQUENCE HYK_ENTRIES_ID_SEQ; CREATE TABLE hyk_entries ( - id int PRIMARY KEY NOT NULL, - hyk_id int NOT NULL REFERENCES hyks(id), - km NUMERIC NOT NULL, + id int PRIMARY KEY NOT NULL, + hyk_id int NOT NULL REFERENCES hyks(id), + km NUMERIC NOT NULL, + distance_vl NUMERIC NOT NULL, + distance_hf NUMERIC NOT NULL, + distance_vr NUMERIC NOT NULL, UNIQUE (hyk_id, km) ); diff -r f08fe480092c -r dd948530fd57 flys-backend/src/main/java/de/intevation/flys/model/HYK.java --- a/flys-backend/src/main/java/de/intevation/flys/model/HYK.java Fri Jul 15 13:07:45 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/HYK.java Fri Jul 15 14:33:12 2011 +0000 @@ -3,6 +3,7 @@ import java.io.Serializable; import java.util.List; +import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; @@ -23,6 +24,7 @@ { private Integer id; private River river; + private Date measure; private String description; private List entries; @@ -30,8 +32,9 @@ public HYK() { } - public HYK(River river, String description) { + public HYK(River river, Date measure, String description) { this.river = river; + this.measure = measure; this.description = description; } @@ -71,6 +74,15 @@ this.description = description; } + @Column(name = "measure") + public Date getMeasure() { + return measure; + } + + public void setMeasure(Date measure) { + this.measure = measure; + } + @OneToMany @OrderBy("km") @JoinColumn(name="hyk_id") diff -r f08fe480092c -r dd948530fd57 flys-backend/src/main/java/de/intevation/flys/model/HYKEntry.java --- a/flys-backend/src/main/java/de/intevation/flys/model/HYKEntry.java Fri Jul 15 13:07:45 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/HYKEntry.java Fri Jul 15 14:33:12 2011 +0000 @@ -26,15 +26,27 @@ private Integer id; private HYK hyk; private BigDecimal km; + private BigDecimal distanceVL; + private BigDecimal distanceHF; + private BigDecimal distanceVR; private List formations; public HYKEntry() { } - public HYKEntry(HYK hyk, BigDecimal km) { - this.hyk = hyk; - this.km = km; + public HYKEntry( + HYK hyk, + BigDecimal km, + BigDecimal distanceVL, + BigDecimal distanceHF, + BigDecimal distanceVR + ) { + this.hyk = hyk; + this.km = km; + this.distanceVL = distanceVL; + this.distanceHF = distanceHF; + this.distanceVR = distanceVR; } @Id @@ -73,6 +85,33 @@ this.km = km; } + @Column(name = "distance_vl") + public BigDecimal getDistanceVL() { + return distanceVL; + } + + public void setDistanceVL(BigDecimal distanceVL) { + this.distanceVL = distanceVL; + } + + @Column(name = "distance_hf") + public BigDecimal getDistanceHF() { + return distanceHF; + } + + public void setDistanceHF(BigDecimal distanceHF) { + this.distanceHF = distanceHF; + } + + @Column(name = "distance_vr") + public BigDecimal getDistanceVR() { + return distanceVR; + } + + public void setDistanceVR(BigDecimal distanceVR) { + this.distanceVR = distanceVR; + } + @OneToMany @OrderBy("formation_num") @JoinColumn(name="hyk_entry_id")