changeset 4776:20b6ebf23916

!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables. Alter existing databases with alter table discharge_tables add column bfg_id varchar(50); This column is now used to synchronize FLYS with the AFT database.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 05 Jan 2013 15:05:51 +0100
parents d9f1202cef78
children 34398f424cfd
files flys-backend/doc/schema/oracle.sql flys-backend/doc/schema/postgresql.sql flys-backend/src/main/java/de/intevation/flys/importer/ImportDischargeTable.java flys-backend/src/main/java/de/intevation/flys/model/DischargeTable.java
diffstat 4 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle.sql	Sat Jan 05 14:52:55 2013 +0100
+++ b/flys-backend/doc/schema/oracle.sql	Sat Jan 05 15:05:51 2013 +0100
@@ -91,6 +91,7 @@
 CREATE TABLE discharge_tables (
     id                  NUMBER(38,0) NOT NULL,
     description         VARCHAR2(255),
+    bfg_id              VARCHAR2(50),
     kind                NUMBER(38,0),
     gauge_id            NUMBER(38,0),
     time_interval_id    NUMBER(38,0),
--- a/flys-backend/doc/schema/postgresql.sql	Sat Jan 05 14:52:55 2013 +0100
+++ b/flys-backend/doc/schema/postgresql.sql	Sat Jan 05 15:05:51 2013 +0100
@@ -145,6 +145,7 @@
     id               int PRIMARY KEY NOT NULL,
     gauge_id         int NOT NULL REFERENCES gauges(id),
     description      VARCHAR(256) NOT NULL,
+    bfg_id           VARCHAR(50),
     kind             int NOT NULL DEFAULT 0,
     time_interval_id int REFERENCES time_intervals(id)
 
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportDischargeTable.java	Sat Jan 05 14:52:55 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportDischargeTable.java	Sat Jan 05 15:05:51 2013 +0100
@@ -87,7 +87,7 @@
 
             List<DischargeTable> dischargeTables = query.list();
             if (dischargeTables.isEmpty()) {
-                peer = new DischargeTable(gauge, description, kind, ti);
+                peer = new DischargeTable(gauge, description, null, kind, ti);
                 session.save(peer);
             }
             else {
--- a/flys-backend/src/main/java/de/intevation/flys/model/DischargeTable.java	Sat Jan 05 14:52:55 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/DischargeTable.java	Sat Jan 05 15:05:51 2013 +0100
@@ -24,6 +24,7 @@
     private Integer      id;
     private Gauge        gauge;
     private String       description;
+    private String       bfgId;
     private Integer      kind;
     private TimeInterval timeInterval;
 
@@ -34,17 +35,19 @@
     }
 
     public DischargeTable(Gauge gauge) {
-        this(gauge, null, 0, null);
+        this(gauge, null, null, 0, null);
     }
 
     public DischargeTable(
         Gauge        gauge,
         String       description,
+        String       bfgId,
         Integer      kind,
         TimeInterval timeInterval
     ) {
         this.gauge        = gauge;
         this.description  = description;
+        this.bfgId        = bfgId;
         this.kind         = kind;
         this.timeInterval = timeInterval;
     }
@@ -85,6 +88,15 @@
         this.description = description;
     }
 
+    @Column(name = "bfg_id")
+    public String getBfgId() {
+        return bfgId;
+    }
+
+    public void setBfgId(String bfgId) {
+        this.bfgId = bfgId;
+    }
+
     @Column(name = "kind")
     public Integer getKind() {
         return kind;

http://dive4elements.wald.intevation.org