added upgrade script for tenant profile

This commit is contained in:
IrynaMatveieva 2025-03-04 09:16:24 +02:00
parent 2363dc8edf
commit eadc705817
2 changed files with 36 additions and 6 deletions

View File

@ -63,4 +63,34 @@ $$;
-- UPDATE SAVE TIME SERIES NODES END
ALTER TABLE api_usage_state ADD COLUMN IF NOT EXISTS version BIGINT DEFAULT 1;
ALTER TABLE api_usage_state ADD COLUMN IF NOT EXISTS version BIGINT DEFAULT 1;
-- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS START
DO $$
BEGIN
-- Check if the tenant_profile table exists
IF EXISTS (
SELECT 1
FROM information_schema.tables
WHERE table_name = 'tenant_profile'
) THEN
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' IS NOT NULL;
END IF;
END;
$$;
-- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS END

View File

@ -135,11 +135,11 @@ public class DefaultTenantProfileConfiguration implements TenantProfileConfigura
private double warnThreshold;
private long maxCalculatedFieldsPerEntity;
private long maxArgumentsPerCF;
private long maxDataPointsPerRollingArg;
private long maxStateSizeInKBytes;
private long maxSingleValueArgumentSizeInKBytes;
private long maxCalculatedFieldsPerEntity = 5;
private long maxArgumentsPerCF = 10;
private long maxDataPointsPerRollingArg = 1000;
private long maxStateSizeInKBytes = 32;
private long maxSingleValueArgumentSizeInKBytes = 2;
@Override
public long getProfileThreshold(ApiUsageRecordKey key) {