Browse Source
Merge pull request #11655 from irynamatveieva/upgrade-script/device-profile-node
Added upgrade script for device profile node
pull/11668/head
Viacheslav Klimov
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
15 additions and
1 deletions
-
application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java
|
|
|
@ -122,7 +122,21 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService |
|
|
|
updateSchema("3.6.4", 3006004, "3.7.0", 3007000, null); |
|
|
|
break; |
|
|
|
case "3.7.0": |
|
|
|
updateSchema("3.7.0", 3007000, "3.7.1", 3007001, null); |
|
|
|
updateSchema("3.7.0", 3007000, "3.7.1", 3007001, connection -> { |
|
|
|
try { |
|
|
|
connection.createStatement().execute("UPDATE rule_node SET " + |
|
|
|
"configuration = CASE " + |
|
|
|
" WHEN (configuration::jsonb ->> 'persistAlarmRulesState') = 'false'" + |
|
|
|
" THEN (configuration::jsonb || '{\"fetchAlarmRulesStateOnStart\": \"false\"}'::jsonb)::varchar " + |
|
|
|
" ELSE configuration " + |
|
|
|
"END, " + |
|
|
|
"configuration_version = 1 " + |
|
|
|
"WHERE type = 'org.thingsboard.rule.engine.profile.TbDeviceProfileNode' " + |
|
|
|
"AND configuration_version < 1;"); |
|
|
|
} catch (Exception e) { |
|
|
|
log.warn("Failed to execute update script for device profile rule nodes due to: ", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion); |
|
|
|
|