# HG changeset patch # User Sascha L. Teichmann # Date 1310745213 0 # Node ID 32ee9babe42cb58f4c9fbc10a9a05602a15450db # Parent cc88db4a5b34abe1f7b22d510448a94d87d9736b Schema: Argh! Added distance_{vl|hf|vr} to wrong table. flys-backend/trunk@2340 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r cc88db4a5b34 -r 32ee9babe42c flys-backend/ChangeLog --- a/flys-backend/ChangeLog Fri Jul 15 15:36:59 2011 +0000 +++ b/flys-backend/ChangeLog Fri Jul 15 15:53:33 2011 +0000 @@ -1,3 +1,21 @@ +2011-07-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Argh! Added distance_{vl|hf|vr} to + wrong table. + To update existing databases: + BEGIN; + ALTER TABLE hyk_entries DROP COLUMN distance_vl; + ALTER TABLE hyk_entries DROP COLUMN distance_hf; + ALTER TABLE hyk_entries DROP COLUMN distance_vr; + ALTER TABLE hyk_formations ADD COLUMN distance_vl NUMERIC NOT NULL; + ALTER TABLE hyk_formations ADD COLUMN distance_hf NUMERIC NOT NULL; + ALTER TABLE hyk_formations ADD COLUMN distance_vr NUMERIC NOT NULL; + COMMIT; + + * src/main/java/de/intevation/flys/model/HYKFormation.java, + src/main/java/de/intevation/flys/model/HYKEntry.java: + Adjusted Hibernate models. + 2011-07-15 Sascha L. Teichmann * src/main/java/de/intevation/flys/utils/FileTools.java: Added method diff -r cc88db4a5b34 -r 32ee9babe42c flys-backend/doc/schema/postgresql.sql --- a/flys-backend/doc/schema/postgresql.sql Fri Jul 15 15:36:59 2011 +0000 +++ b/flys-backend/doc/schema/postgresql.sql Fri Jul 15 15:53:33 2011 +0000 @@ -308,9 +308,6 @@ 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) ); @@ -322,6 +319,9 @@ hyk_entry_id int NOT NULL REFERENCES hyk_entries(id), top NUMERIC NOT NULL, bottom NUMERIC NOT NULL, + distance_vl NUMERIC NOT NULL, + distance_hf NUMERIC NOT NULL, + distance_vr NUMERIC NOT NULL, UNIQUE (hyk_entry_id, formation_num) ); diff -r cc88db4a5b34 -r 32ee9babe42c 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 15:36:59 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/HYKEntry.java Fri Jul 15 15:53:33 2011 +0000 @@ -26,27 +26,15 @@ 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, - BigDecimal distanceVL, - BigDecimal distanceHF, - BigDecimal distanceVR - ) { - this.hyk = hyk; - this.km = km; - this.distanceVL = distanceVL; - this.distanceHF = distanceHF; - this.distanceVR = distanceVR; + public HYKEntry(HYK hyk, BigDecimal km) { + this.hyk = hyk; + this.km = km; } @Id @@ -85,33 +73,6 @@ 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") diff -r cc88db4a5b34 -r 32ee9babe42c flys-backend/src/main/java/de/intevation/flys/model/HYKFormation.java --- a/flys-backend/src/main/java/de/intevation/flys/model/HYKFormation.java Fri Jul 15 15:36:59 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/HYKFormation.java Fri Jul 15 15:53:33 2011 +0000 @@ -28,6 +28,9 @@ private HYKEntry entry; private BigDecimal top; private BigDecimal bottom; + private BigDecimal distanceVL; + private BigDecimal distanceHF; + private BigDecimal distanceVR; private List zones; @@ -38,12 +41,18 @@ Integer formationNum, HYKEntry entry, BigDecimal top, - BigDecimal bottom + BigDecimal bottom, + BigDecimal distanceVL, + BigDecimal distanceHF, + BigDecimal distanceVR ) { this.formationNum = formationNum; this.entry = entry; this.top = top; this.bottom = bottom; + this.distanceVL = distanceVL; + this.distanceHF = distanceHF; + this.distanceVR = distanceVR; } @Id @@ -100,6 +109,34 @@ this.bottom = bottom; } + @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("a") @JoinColumn(name="formation_id")