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'; WHERE name = 'tableRowInsertedCountToBeBetween';
-- End of Test Definition Parameter Definition Validation Migration -- End of Test Definition Parameter Definition Validation Migration
-- update existing customLogoConfiguration config with new customUiThemePreference -- Start of updating existing customLogoConfiguration config with new customUiThemePreference
UPDATE openmetadata_settings UPDATE openmetadata_settings AS ui
JOIN openmetadata_settings AS logo
ON ui.configType = 'customUiThemePreference' AND logo.configType = 'customLogoConfiguration'
SET SET
configType = 'customUiThemePreference', ui.json = JSON_OBJECT(
json = JSON_OBJECT(
'customTheme', JSON_OBJECT(
'infoColor', '',
'errorColor', '',
'primaryColor', '',
'successColor', '',
'warningColor', ''
),
'customLogoConfig', JSON_OBJECT( 'customLogoConfig', JSON_OBJECT(
'customLogoUrlPath', JSON_UNQUOTE(JSON_EXTRACT(json, '$.customLogoUrlPath')), 'customLogoUrlPath', JSON_UNQUOTE(JSON_EXTRACT(logo.json, '$.customLogoUrlPath')),
'customFaviconUrlPath', JSON_UNQUOTE(JSON_EXTRACT(json, '$.customFaviconUrlPath')), 'customFaviconUrlPath', JSON_UNQUOTE(JSON_EXTRACT(logo.json, '$.customFaviconUrlPath')),
'customMonogramUrlPath', JSON_UNQUOTE(JSON_EXTRACT(json, '$.customMonogramUrlPath')) 'customMonogramUrlPath', JSON_UNQUOTE(JSON_EXTRACT(logo.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'; WHERE name = 'tableRowInsertedCountToBeBetween';
-- End of Test Definition Parameter Definition Validation Migration -- End of Test Definition Parameter Definition Validation Migration
-- update existing customLogoConfiguration config with new customUiThemePreference -- Start of updating existing customLogoConfiguration config with new customUiThemePreference
UPDATE openmetadata_settings UPDATE openmetadata_settings AS ui
SET SET json = jsonb_build_object(
configType = 'customUiThemePreference',
json = jsonb_build_object(
'customTheme', jsonb_build_object(
'infoColor', '',
'errorColor', '',
'primaryColor', '',
'successColor', '',
'warningColor', ''
),
'customLogoConfig', jsonb_build_object( 'customLogoConfig', jsonb_build_object(
'customLogoUrlPath', (json ->> 'customLogoUrlPath'), 'customLogoUrlPath', logo.json -> 'customLogoUrlPath',
'customFaviconUrlPath', (json ->> 'customFaviconUrlPath'), 'customFaviconUrlPath', logo.json -> 'customFaviconUrlPath',
'customMonogramUrlPath', (json ->> 'customMonogramUrlPath') '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( .withCustomLogoConfig(
new LogoConfiguration() new LogoConfiguration()
.withCustomLogoUrlPath("") .withCustomLogoUrlPath("")
.withCustomFaviconUrlPath("")
.withCustomMonogramUrlPath("")) .withCustomMonogramUrlPath(""))
.withCustomTheme( .withCustomTheme(
new ThemeConfiguration() new ThemeConfiguration()