Merge branch 'master' into feature/js-module

This commit is contained in:
Igor Kulikov 2024-12-03 11:03:43 +02:00
commit cc468e34f7
5 changed files with 15 additions and 9 deletions

View File

@ -100,19 +100,24 @@ public class ThingsboardInstallService {
log.info("Migrating ThingsBoard latest timeseries data from cassandra to SQL database ...");
latestMigrateService.migrate();
} else {
// TODO DON'T FORGET to update SUPPORTED_VERSIONS_FROM in DefaultDatabaseSchemaSettingsService
databaseSchemaVersionService.validateSchemaSettings();
//TODO DON'T FORGET to update SUPPORTED_VERSIONS_FROM in DatabaseSchemaVersionService,
// this list should include last version and can include previous versions without upgrade
String fromVersion = databaseSchemaVersionService.getDbSchemaVersion();
String toVersion = databaseSchemaVersionService.getPackageSchemaVersion();
log.info("Upgrading ThingsBoard from version {} to {} ...", fromVersion, toVersion);
cacheCleanupService.clearCache();
entityDatabaseSchemaService.createDatabaseSchema(false);
// Apply the schema_update.sql script. The script may include DDL statements to change structure
// of *existing* tables and DML statements to manipulate the DB records.
databaseEntitiesUpgradeService.upgradeDatabase();
dataUpdateService.updateData(); //TODO: update data should be cleaned after each release
// All new tables that do not have any data will be automatically created here.
entityDatabaseSchemaService.createDatabaseSchema(false);
// Runs upgrade scripts that are not possible in plain SQL.
// TODO: clear after each release
dataUpdateService.updateData();
// Re-create all views, functions.
entityDatabaseSchemaService.createOrUpdateViewsAndFunctions();
entityDatabaseSchemaService.createOrUpdateDeviceInfoView(persistToTelemetry);
// Creates missing indexes.
entityDatabaseSchemaService.createDatabaseIndexes();
log.info("Updating system data...");
dataUpdateService.upgradeRuleNodes();

View File

@ -16,6 +16,7 @@
package org.thingsboard.server.service.install;
public interface DatabaseSchemaSettingsService {
void validateSchemaSettings();
void createSchemaSettings();
@ -25,4 +26,5 @@ public interface DatabaseSchemaSettingsService {
String getPackageSchemaVersion();
String getDbSchemaVersion();
}

View File

@ -32,6 +32,8 @@ import java.util.List;
public class DefaultDatabaseSchemaSettingsService implements DatabaseSchemaSettingsService {
private static final String CURRENT_PRODUCT = "CE";
// This list should include all versions which are compatible for the upgrade.
// The compatibility cycle usually breaks when we have some scripts written in Java that may not work after new release.
private static final List<String> SUPPORTED_VERSIONS_FOR_UPGRADE = List.of("3.8.0", "3.8.1");
private final BuildProperties buildProperties;

View File

@ -15,9 +15,7 @@
*/
package org.thingsboard.server.service.subscription;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
@ -25,7 +23,6 @@ import java.util.Objects;
import java.util.function.BiConsumer;
@Data
@RequiredArgsConstructor
public abstract class TbSubscription<T> {
/** Cache the hash code */