Commit 8fdfa909dbc211ec5078e5bcdaa710ff37b92c7d
1 parent
1f60a19d
Was modified classes to config and create DB for EntityView model
Showing
3 changed files
with
20 additions
and
0 deletions
@@ -88,6 +88,13 @@ public class ThingsboardInstallService { | @@ -88,6 +88,13 @@ public class ThingsboardInstallService { | ||
88 | 88 | ||
89 | dataUpdateService.updateData("1.4.0"); | 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 | log.info("Updating system data..."); | 98 | log.info("Updating system data..."); |
92 | 99 | ||
93 | systemDataLoaderService.deleteSystemWidgetBundle("charts"); | 100 | systemDataLoaderService.deleteSystemWidgetBundle("charts"); |
@@ -49,6 +49,10 @@ public class DefaultDataUpdateService implements DataUpdateService { | @@ -49,6 +49,10 @@ public class DefaultDataUpdateService implements DataUpdateService { | ||
49 | log.info("Updating data from version 1.4.0 to 2.0.0 ..."); | 49 | log.info("Updating data from version 1.4.0 to 2.0.0 ..."); |
50 | tenantsDefaultRuleChainUpdater.updateEntities(null); | 50 | tenantsDefaultRuleChainUpdater.updateEntities(null); |
51 | break; | 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 | default: | 56 | default: |
53 | throw new RuntimeException("Unable to update data, unsupported fromVersion: " + fromVersion); | 57 | throw new RuntimeException("Unable to update data, unsupported fromVersion: " + fromVersion); |
54 | } | 58 | } |
@@ -107,6 +107,15 @@ public class SqlDatabaseUpgradeService implements DatabaseUpgradeService { | @@ -107,6 +107,15 @@ public class SqlDatabaseUpgradeService implements DatabaseUpgradeService { | ||
107 | log.info("Schema updated."); | 107 | log.info("Schema updated."); |
108 | } | 108 | } |
109 | break; | 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 | default: | 119 | default: |
111 | throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion); | 120 | throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion); |
112 | } | 121 | } |