Commit 8fdfa909dbc211ec5078e5bcdaa710ff37b92c7d

Authored by viktorbasanets
1 parent 1f60a19d

Was modified classes to config and create DB for EntityView model

... ... @@ -88,6 +88,13 @@ public class ThingsboardInstallService {
88 88
89 89 dataUpdateService.updateData("1.4.0");
90 90
  91 + case "2.0.0":
  92 + log.info("Upgrading ThingsBoard from version 2.0.0 to 2.1.1 ...");
  93 +
  94 + databaseUpgradeService.upgradeDatabase("2.0.0");
  95 +
  96 + dataUpdateService.updateData("2.0.0");
  97 +
91 98 log.info("Updating system data...");
92 99
93 100 systemDataLoaderService.deleteSystemWidgetBundle("charts");
... ...
... ... @@ -49,6 +49,10 @@ public class DefaultDataUpdateService implements DataUpdateService {
49 49 log.info("Updating data from version 1.4.0 to 2.0.0 ...");
50 50 tenantsDefaultRuleChainUpdater.updateEntities(null);
51 51 break;
  52 + case "2.0.0":
  53 + log.info("Updating data from version 2.0.0 to 2.1.1 ...");
  54 + tenantsDefaultRuleChainUpdater.updateEntities(null);
  55 + break;
52 56 default:
53 57 throw new RuntimeException("Unable to update data, unsupported fromVersion: " + fromVersion);
54 58 }
... ...
... ... @@ -107,6 +107,15 @@ public class SqlDatabaseUpgradeService implements DatabaseUpgradeService {
107 107 log.info("Schema updated.");
108 108 }
109 109 break;
  110 + case "2.0.0":
  111 + try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
  112 + log.info("Updating schema ...");
  113 + schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "2.1.1", SCHEMA_UPDATE_SQL);
  114 + loadSql(schemaUpdateFile, conn);
  115 + log.info("Schema updated.");
  116 + }
  117 + break;
  118 +
110 119 default:
111 120 throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
112 121 }
... ...