Browse Source

Add 3.1.0 -> 3.1.1 upgrade

pull/3303/head
Igor Kulikov 6 years ago
parent
commit
dc0572f81c
  1. 17
      application/src/main/data/upgrade/3.1.0/schema_update.sql
  2. 3
      application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java
  3. 8
      application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java

17
application/src/main/data/upgrade/3.1.0/schema_update.sql

@ -0,0 +1,17 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
CREATE INDEX IF NOT EXISTS idx_alarm_tenant_alarm_type_created_time ON alarm(tenant_id, type, created_time DESC);

3
application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java

@ -172,6 +172,9 @@ public class ThingsboardInstallService {
log.info("Upgrading ThingsBoard from version 3.0.1 to 3.1.0 ...");
databaseEntitiesUpgradeService.upgradeDatabase("3.0.1");
dataUpdateService.updateData("3.0.1");
case "3.1.0":
log.info("Upgrading ThingsBoard from version 3.1.0 to 3.1.1 ...");
databaseEntitiesUpgradeService.upgradeDatabase("3.1.0");
log.info("Updating system data...");
systemDataLoaderService.updateSystemWidgets();
break;

8
application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java

@ -295,6 +295,14 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
log.error("Failed updating schema!!!", e);
}
break;
case "3.1.0":
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
log.info("Updating schema ...");
schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "3.1.0", SCHEMA_UPDATE_SQL);
loadSql(schemaUpdateFile, conn);
log.info("Schema updated.");
}
break;
default:
throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion);
}

Loading…
Cancel
Save