From 13e9cc5588ec5a7a97683c4000e87c70decd9d63 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Wed, 24 Oct 2018 12:47:10 +0200
Subject: [PATCH] line type enum mapping changed to string in polyline_data

---
 .../mapviewer/model/graphics/PolylineData.java |  3 +++
 ...20181024.3__line_type_changed_to_string.sql | 18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/model/src/main/java/lcsb/mapviewer/model/graphics/PolylineData.java b/model/src/main/java/lcsb/mapviewer/model/graphics/PolylineData.java
index 27248dcef0..745885f499 100644
--- a/model/src/main/java/lcsb/mapviewer/model/graphics/PolylineData.java
+++ b/model/src/main/java/lcsb/mapviewer/model/graphics/PolylineData.java
@@ -12,6 +12,8 @@ import javax.persistence.CollectionTable;
 import javax.persistence.Column;
 import javax.persistence.ElementCollection;
 import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
@@ -100,6 +102,7 @@ public class PolylineData implements Serializable {
   /**
    * Type of the line (pattern used to draw it).
    */
+  @Enumerated(EnumType.STRING)
   private LineType type = LineType.SOLID;
 
   /**
diff --git a/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181024.3__line_type_changed_to_string.sql b/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181024.3__line_type_changed_to_string.sql
index 1eaac5c0dd..125bb3bf95 100644
--- a/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181024.3__line_type_changed_to_string.sql
+++ b/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181024.3__line_type_changed_to_string.sql
@@ -1,3 +1,4 @@
+-- change in arrow_type_data
 alter table arrow_type_data add column arrow_line_type_string varchar(31);
 update arrow_type_data set arrow_line_type_string='SOLID' where arrow_line_type=0;
 update arrow_type_data set arrow_line_type_string='SOLID_BOLD' where arrow_line_type=1;
@@ -9,4 +10,19 @@ update arrow_type_data set arrow_line_type_string='DASHED_BOLD' where arrow_line
 update arrow_type_data set arrow_line_type_string='DOUBLE' where arrow_line_type=7;
 
 alter table arrow_type_data drop column arrow_line_type;
-alter table arrow_type_data rename column arrow_line_type_string to arrow_line_type;
\ No newline at end of file
+alter table arrow_type_data rename column arrow_line_type_string to arrow_line_type;
+
+-- change in polyline_data
+alter table polyline_data add column type_string varchar(31);
+update polyline_data set type_string='SOLID' where type=0;
+update polyline_data set type_string='SOLID_BOLD' where type=1;
+update polyline_data set type_string='DASH_DOT_DOT' where type=2;
+update polyline_data set type_string='DASH_DOT' where type=3;
+update polyline_data set type_string='DASHED' where type=4;
+update polyline_data set type_string='DOTTED' where type=5;
+update polyline_data set type_string='DASHED_BOLD' where type=6;
+update polyline_data set type_string='DOUBLE' where type=7;
+
+alter table polyline_data drop column type;
+alter table polyline_data rename column type_string to type;
+
-- 
GitLab