update SettingsCache and fix migration issues (#16052)

* update SettingsCache and fix migration issues

* java checkstyle change
This commit is contained in:
sonika-shah 2024-04-29 09:26:09 +05:30 committed by GitHub
parent 26db024379
commit c6afcce52d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 40 additions and 32 deletions

View File

@ -363,22 +363,26 @@ set json = JSON_INSERT(
WHERE name = 'tableRowInsertedCountToBeBetween';
-- End of Test Definition Parameter Definition Validation Migration
-- update existing customLogoConfiguration config with new customUiThemePreference
UPDATE openmetadata_settings
-- Start of updating existing customLogoConfiguration config with new customUiThemePreference
UPDATE openmetadata_settings AS ui
JOIN openmetadata_settings AS logo
ON ui.configType = 'customUiThemePreference' AND logo.configType = 'customLogoConfiguration'
SET
configType = 'customUiThemePreference',
json = JSON_OBJECT(
'customTheme', JSON_OBJECT(
'infoColor', '',
'errorColor', '',
'primaryColor', '',
'successColor', '',
'warningColor', ''
ui.json = JSON_OBJECT(
'customLogoConfig', JSON_OBJECT(
'customLogoUrlPath', JSON_UNQUOTE(JSON_EXTRACT(logo.json, '$.customLogoUrlPath')),
'customFaviconUrlPath', JSON_UNQUOTE(JSON_EXTRACT(logo.json, '$.customFaviconUrlPath')),
'customMonogramUrlPath', JSON_UNQUOTE(JSON_EXTRACT(logo.json, '$.customMonogramUrlPath'))
),
'customLogoConfig', JSON_OBJECT(
'customLogoUrlPath', JSON_UNQUOTE(JSON_EXTRACT(json, '$.customLogoUrlPath')),
'customFaviconUrlPath', JSON_UNQUOTE(JSON_EXTRACT(json, '$.customFaviconUrlPath')),
'customMonogramUrlPath', JSON_UNQUOTE(JSON_EXTRACT(json, '$.customMonogramUrlPath'))
'customTheme', JSON_OBJECT(
'primaryColor', '',
'errorColor', '',
'successColor', '',
'warningColor', '',
'infoColor', ''
)
)
WHERE configType = 'customLogoConfiguration';
WHERE ui.configType = 'customUiThemePreference';
DELETE from openmetadata_settings where configType = 'customLogoConfiguration';
-- End of updating customUiThemePreference config

View File

@ -363,22 +363,25 @@ SET json = jsonb_set(
WHERE name = 'tableRowInsertedCountToBeBetween';
-- End of Test Definition Parameter Definition Validation Migration
-- update existing customLogoConfiguration config with new customUiThemePreference
UPDATE openmetadata_settings
SET
configType = 'customUiThemePreference',
json = jsonb_build_object(
'customTheme', jsonb_build_object(
'infoColor', '',
'errorColor', '',
'primaryColor', '',
'successColor', '',
'warningColor', ''
),
-- Start of updating existing customLogoConfiguration config with new customUiThemePreference
UPDATE openmetadata_settings AS ui
SET json = jsonb_build_object(
'customLogoConfig', jsonb_build_object(
'customLogoUrlPath', (json ->> 'customLogoUrlPath'),
'customFaviconUrlPath', (json ->> 'customFaviconUrlPath'),
'customMonogramUrlPath', (json ->> 'customMonogramUrlPath')
'customLogoUrlPath', logo.json -> 'customLogoUrlPath',
'customFaviconUrlPath', logo.json -> 'customFaviconUrlPath',
'customMonogramUrlPath', logo.json -> 'customMonogramUrlPath'
),
'customTheme', jsonb_build_object(
'primaryColor', '',
'errorColor', '',
'successColor', '',
'warningColor', '',
'infoColor', ''
)
)
WHERE configType = 'customLogoConfiguration';
)
FROM openmetadata_settings AS logo
WHERE ui.configType = 'customUiThemePreference'
AND logo.configType = 'customLogoConfiguration';
DELETE from openmetadata_settings where configType = 'customLogoConfiguration';
-- End of updating customUiThemePreference config

View File

@ -84,6 +84,7 @@ public class SettingsCache {
.withCustomLogoConfig(
new LogoConfiguration()
.withCustomLogoUrlPath("")
.withCustomFaviconUrlPath("")
.withCustomMonogramUrlPath(""))
.withCustomTheme(
new ThemeConfiguration()