2024-09-17 13:14:28 +03:00
|
|
|
--
|
2025-02-25 09:39:16 +02:00
|
|
|
-- Copyright © 2016-2025 The Thingsboard Authors
|
2024-09-17 13:14:28 +03:00
|
|
|
--
|
|
|
|
|
-- 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.
|
|
|
|
|
--
|
|
|
|
|
|
2025-01-13 12:16:12 +02:00
|
|
|
-- UPDATE SAVE TIME SERIES NODES START
|
|
|
|
|
|
2025-03-03 17:23:01 +02:00
|
|
|
UPDATE rule_node
|
|
|
|
|
SET configuration = (
|
|
|
|
|
(configuration::jsonb - 'skipLatestPersistence')
|
|
|
|
|
|| jsonb_build_object(
|
|
|
|
|
'processingSettings', jsonb_build_object(
|
|
|
|
|
'type', 'ADVANCED',
|
|
|
|
|
'timeseries', jsonb_build_object('type', 'ON_EVERY_MESSAGE'),
|
|
|
|
|
'latest', jsonb_build_object('type', 'SKIP'),
|
|
|
|
|
'webSockets', jsonb_build_object('type', 'ON_EVERY_MESSAGE'),
|
|
|
|
|
'calculatedFields', jsonb_build_object('type', 'ON_EVERY_MESSAGE')
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)::text,
|
|
|
|
|
configuration_version = 1
|
|
|
|
|
WHERE type = 'org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode'
|
|
|
|
|
AND configuration_version = 0
|
|
|
|
|
AND configuration::jsonb ->> 'skipLatestPersistence' = 'true';
|
2025-01-13 12:16:12 +02:00
|
|
|
|
2025-03-03 17:23:01 +02:00
|
|
|
UPDATE rule_node
|
|
|
|
|
SET configuration = (
|
|
|
|
|
(configuration::jsonb - 'skipLatestPersistence')
|
|
|
|
|
|| jsonb_build_object(
|
|
|
|
|
'processingSettings', jsonb_build_object(
|
|
|
|
|
'type', 'ON_EVERY_MESSAGE'
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)::text,
|
|
|
|
|
configuration_version = 1
|
|
|
|
|
WHERE type = 'org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode'
|
|
|
|
|
AND configuration_version = 0
|
|
|
|
|
AND (configuration::jsonb ->> 'skipLatestPersistence' != 'true' OR configuration::jsonb ->> 'skipLatestPersistence' IS NULL);
|
2025-01-13 12:16:12 +02:00
|
|
|
|
|
|
|
|
-- UPDATE SAVE TIME SERIES NODES END
|
2025-02-10 14:28:46 +02:00
|
|
|
|
2025-02-26 16:28:46 +02:00
|
|
|
-- UPDATE SAVE ATTRIBUTES NODES START
|
|
|
|
|
|
2025-03-03 17:23:01 +02:00
|
|
|
UPDATE rule_node
|
|
|
|
|
SET configuration = (
|
|
|
|
|
configuration::jsonb
|
|
|
|
|
|| jsonb_build_object(
|
|
|
|
|
'processingSettings', jsonb_build_object('type', 'ON_EVERY_MESSAGE')
|
|
|
|
|
)
|
|
|
|
|
)::text,
|
|
|
|
|
configuration_version = 3
|
|
|
|
|
WHERE type = 'org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode'
|
|
|
|
|
AND configuration_version = 2;
|
2025-02-26 16:28:46 +02:00
|
|
|
|
|
|
|
|
-- UPDATE SAVE ATTRIBUTES NODES END
|
|
|
|
|
|
|
|
|
|
ALTER TABLE api_usage_state ADD COLUMN IF NOT EXISTS version BIGINT DEFAULT 1;
|
2025-03-04 09:16:24 +02:00
|
|
|
|
|
|
|
|
-- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS START
|
|
|
|
|
|
2025-03-04 14:02:53 +02:00
|
|
|
UPDATE tenant_profile
|
|
|
|
|
SET profile_data = profile_data
|
|
|
|
|
|| jsonb_build_object(
|
|
|
|
|
'configuration', profile_data->'configuration' || jsonb_build_object(
|
|
|
|
|
'maxCalculatedFieldsPerEntity', COALESCE(profile_data->'configuration'->>'maxCalculatedFieldsPerEntity', '5')::bigint,
|
|
|
|
|
'maxArgumentsPerCF', COALESCE(profile_data->'configuration'->>'maxArgumentsPerCF', '10')::bigint,
|
|
|
|
|
'maxDataPointsPerRollingArg', COALESCE(profile_data->'configuration'->>'maxDataPointsPerRollingArg', '1000')::bigint,
|
|
|
|
|
'maxStateSizeInKBytes', COALESCE(profile_data->'configuration'->>'maxStateSizeInKBytes', '32')::bigint,
|
|
|
|
|
'maxSingleValueArgumentSizeInKBytes', COALESCE(profile_data->'configuration'->>'maxSingleValueArgumentSizeInKBytes', '2')::bigint
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
WHERE profile_data->'configuration'->>'maxCalculatedFieldsPerEntity' IS NULL;
|
2025-03-04 09:16:24 +02:00
|
|
|
|
|
|
|
|
-- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS END
|