From 73dafce95786b0e108a5e7939c3bcedf207e080a Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Wed, 24 Oct 2018 12:31:00 +0200
Subject: [PATCH] arrow type enum is mapped as string

---
 .../mapviewer/model/graphics/ArrowTypeData.java     |  3 +++
 ...2.0.20181024.2__arrow_type_changed_to_string.sql | 13 +++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181024.2__arrow_type_changed_to_string.sql

diff --git a/model/src/main/java/lcsb/mapviewer/model/graphics/ArrowTypeData.java b/model/src/main/java/lcsb/mapviewer/model/graphics/ArrowTypeData.java
index 904f23781c..17d57cfa35 100644
--- a/model/src/main/java/lcsb/mapviewer/model/graphics/ArrowTypeData.java
+++ b/model/src/main/java/lcsb/mapviewer/model/graphics/ArrowTypeData.java
@@ -3,6 +3,8 @@ package lcsb.mapviewer.model.graphics;
 import java.io.Serializable;
 
 import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
@@ -42,6 +44,7 @@ public class ArrowTypeData implements Serializable {
   /**
    * Type of the arrow.
    */
+  @Enumerated(EnumType.STRING)
   private ArrowType arrowType;
 
   /**
diff --git a/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181024.2__arrow_type_changed_to_string.sql b/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181024.2__arrow_type_changed_to_string.sql
new file mode 100644
index 0000000000..e355e4a5b5
--- /dev/null
+++ b/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181024.2__arrow_type_changed_to_string.sql
@@ -0,0 +1,13 @@
+alter table arrow_type_data add column arrow_type_string varchar(31);
+update arrow_type_data set arrow_type_string='BLANK_CROSSBAR' where arrow_type=0;
+update arrow_type_data set arrow_type_string='FULL_CROSSBAR' where arrow_type=1;
+update arrow_type_data set arrow_type_string='DIAMOND' where arrow_type=2;
+update arrow_type_data set arrow_type_string='BLANK' where arrow_type=3;
+update arrow_type_data set arrow_type_string='CROSSBAR' where arrow_type=4;
+update arrow_type_data set arrow_type_string='CIRCLE' where arrow_type=5;
+update arrow_type_data set arrow_type_string='OPEN' where arrow_type=6;
+update arrow_type_data set arrow_type_string='FULL' where arrow_type=7;
+update arrow_type_data set arrow_type_string='NONE' where arrow_type=8;
+
+alter table arrow_type_data drop column arrow_type;
+alter table arrow_type_data rename column arrow_type_string to arrow_type;
\ No newline at end of file
-- 
GitLab