SKIP_IMAGES_MIGRATION upgrade option

This commit is contained in:
ViacheslavKlimov 2023-12-01 16:18:53 +02:00
parent 5b98fa9302
commit 3233d1b97e
2 changed files with 7 additions and 1 deletions

View File

@ -271,6 +271,12 @@ public class ThingsboardInstallService {
case "3.6.1":
log.info("Upgrading ThingsBoard from version 3.6.1 to 3.6.2 ...");
databaseEntitiesUpgradeService.upgradeDatabase("3.6.1");
installScripts.loadSystemImages();
if (!getEnv("SKIP_IMAGES_MIGRATION", false)) {
installScripts.updateImages();
} else {
log.info("Skipping images migration. Run the upgrade with fromVersion as '3.6.2-images' to migrate");
}
//TODO DON'T FORGET to update switch statement in the CacheCleanupService if you need to clear the cache
break;
default:
@ -282,7 +288,6 @@ public class ThingsboardInstallService {
dataUpdateService.upgradeRuleNodes();
systemDataLoaderService.loadSystemWidgets();
installScripts.loadSystemLwm2mResources();
installScripts.loadSystemImages();
}
log.info("Upgrade finished successfully!");

View File

@ -311,6 +311,7 @@ public class InstallScripts {
@SneakyThrows
public void loadSystemImages() {
log.info("Loading system images...");
Stream<Path> dashboardsFiles = Files.list(Paths.get(getDataDir(), JSON_DIR, DEMO_DIR, DASHBOARDS_DIR));
try (dashboardsFiles) {
dashboardsFiles.forEach(file -> {