Showing
1 changed file
with
7 additions
and
0 deletions
@@ -30,6 +30,7 @@ import java.nio.file.Path; | @@ -30,6 +30,7 @@ import java.nio.file.Path; | ||
30 | import java.nio.file.Paths; | 30 | import java.nio.file.Paths; |
31 | import java.sql.Connection; | 31 | import java.sql.Connection; |
32 | import java.sql.DriverManager; | 32 | import java.sql.DriverManager; |
33 | +import java.sql.SQLSyntaxErrorException; | ||
33 | 34 | ||
34 | import static org.thingsboard.server.service.install.DatabaseHelper.ADDITIONAL_INFO; | 35 | import static org.thingsboard.server.service.install.DatabaseHelper.ADDITIONAL_INFO; |
35 | import static org.thingsboard.server.service.install.DatabaseHelper.ASSIGNED_CUSTOMERS; | 36 | import static org.thingsboard.server.service.install.DatabaseHelper.ASSIGNED_CUSTOMERS; |
@@ -213,6 +214,12 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService | @@ -213,6 +214,12 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService | ||
213 | try { | 214 | try { |
214 | conn.createStatement().execute("ALTER TABLE attribute_kv ADD COLUMN json_v json;"); | 215 | conn.createStatement().execute("ALTER TABLE attribute_kv ADD COLUMN json_v json;"); |
215 | } catch (Exception e) { | 216 | } catch (Exception e) { |
217 | + if (e instanceof SQLSyntaxErrorException) { | ||
218 | + try { | ||
219 | + conn.createStatement().execute("ALTER TABLE attribute_kv ADD COLUMN json_v varchar(10000000);"); | ||
220 | + } catch (Exception e1) { | ||
221 | + } | ||
222 | + } | ||
216 | } | 223 | } |
217 | try { | 224 | try { |
218 | conn.createStatement().execute("ALTER TABLE dashboard ALTER COLUMN configuration SET DATA TYPE varchar(100000000);"); //NOSONAR, ignoring because method used to execute thingsboard database upgrade script | 225 | conn.createStatement().execute("ALTER TABLE dashboard ALTER COLUMN configuration SET DATA TYPE varchar(100000000);"); //NOSONAR, ignoring because method used to execute thingsboard database upgrade script |