OpenMetadata/bootstrap/sql/migrations/native/1.4.0/postgres/postDataMigrationSQLScript.sql
sonika-shah a9773b9527
Add predefined color palette for UI styling assets (#15982)
* Add predefined color palette for UI styling assets - backend

* Update UI components to use customLogoConfig in applicationConfig

* Update UI components to use customLogoConfig and customTheme in applicationConfig

* Update UI components to use customLogoConfig and customTheme in applicationConfig

* Update UI components to use customLogoConfig and customTheme in AppearanceConfigSettingsPage.tsx

* Update UI components to use customLogoConfig and customTheme in AppearanceConfigSettingsPage.test.tsx

* Remove existing customLogoConfiguration

* Refactor App.tsx and ThemeUtils.ts files

* Update AppearanceConfigSettingsPage.tsx with new imports and default theme values

* Update AppearanceConfigSettingsPage.tsx with new imports and reset functionality

* add cypress test

* Fix color update issue in CustomThemeConfig.spec.ts

* Remove existing customLogoConfiguration -migration changes

* Fix theme configuration initialization in useApplicationStore.ts

* Update CustomThemeConfig.spec.ts to check if the color is updated

* update existing customLogoConfiguration with customUiThemePreference -migration changes

* Update CustomThemeConfig.spec.ts to fix color update check

* Add unit tests for ThemeUtils

* move validateJsonSchema method to JsonUtils

---------

Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-04-25 22:43:02 +05:30

384 lines
14 KiB
SQL

-- Start of Test Definition Parameter Definition Validation Migration
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minValue',
'dataType', 'INT',
'required', false,
'description', 'The {minValue} value for the column entry. If minValue is not included, maxValue is treated as upperBound and there will be no minimum',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxValue',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxValue',
'dataType', 'INT',
'required', false,
'description', 'The {maxValue} value for the column entry. if maxValue is not included, minValue is treated as lowerBound and there will be no maximum',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minValue',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'columnValuesToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minValueForMaxInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected minimum value in the column to be greater or equal than',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxValueForMaxInCol',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxValueForMaxInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected maximum value in the column to be lower or equal than',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minValueForMaxInCol',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'columnValueMaxToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minValueForMeanInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected mean value for the column to be greater or equal than',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxValueForMeanInCol',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxValueForMeanInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected mean value for the column to be lower or equal than',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minValueForMeanInCol',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'columnValueMeanToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minValueForMedianInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected median value for the column to be greater or equal than',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxValueForMedianInCol',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxValueForMedianInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected median value for the column to be lower or equal than',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minValueForMedianInCol',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'columnValueMedianToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minValueForMinInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected minimum value in the column to be greater or equal than',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxValueForMinInCol',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxValueForMinInCol',
'dataType', 'INT',
'required', false,
'description', 'Expect minimum value in the column to be lower or equal than',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minValueForMeanInCol',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'columnValueMinToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minLength',
'dataType', 'INT',
'required', false,
'description', 'The {minLength} for the column value. If minLength is not included, maxLength is treated as upperBound and there will be no minimum value length',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxLength',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxLength',
'dataType', 'INT',
'required', false,
'description', 'The {maxLength} for the column value. if maxLength is not included, minLength is treated as lowerBound and there will be no maximum value length',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minLength',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'columnValueLengthsToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minValueForColSum',
'dataType', 'INT',
'required', false,
'description', 'Expected sum of values in the column to be greater or equal than',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxValueForColSum',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxValueForColSum',
'dataType', 'INT',
'required', false,
'description', 'Expected sum values in the column to be lower or equal than',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minValueForColSum',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'columnValuesSumToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minValueForStdDevInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected std. dev value for the column to be greater or equal than',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxValueForStdDevInCol',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxValueForStdDevInCol',
'dataType', 'INT',
'required', false,
'description', 'Expected std. dev value for the column to be lower or equal than',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minValueForStdDevInCol',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'columnValueStdDevToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minColValue',
'dataType', 'INT',
'required', false,
'description', 'Expected number of columns should be greater than or equal to {minValue}. If minValue is not included, maxValue is treated as upperBound and there will be no minimum number of column',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxColValue',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxColValue',
'dataType', 'INT',
'required', false,
'description', 'Expected number of columns should be less than or equal to {maxValue}. If maxValue is not included, minValue is treated as lowerBound and there will be no maximum number of column',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minColValue',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'tableColumnCountToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'minValue',
'dataType', 'INT',
'required', false,
'description', 'Expected number of columns should be greater than or equal to {minValue}. If minValue is not included, maxValue is treated as upperBound and there will be no minimum',
'displayName', 'Min',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'maxValue',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'maxValue',
'dataType', 'INT',
'required', false,
'description', 'Expected number of columns should be less than or equal to {maxValue}. If maxValue is not included, minValue is treated as lowerBound and there will be no maximum',
'displayName', 'Max',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'minValue',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
WHERE name = 'tableRowCountToBeBetween';
UPDATE test_definition
SET json = jsonb_set(
jsonb_delete(json, '$.parameterDefinition'),
'{parameterDefinition}',
jsonb_build_array(
jsonb_build_object(
'name', 'min',
'dataType', 'INT',
'required', false,
'description', 'Lower Bound of the Count',
'displayName', 'Min Row Count',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'max',
'rule', 'LESS_THAN_OR_EQUALS'
)
),
jsonb_build_object(
'name', 'max',
'dataType', 'INT',
'required', false,
'description', 'Upper Bound of the Count',
'displayName', 'Max Row Count',
'optionValues', '[]'::jsonb,
'validationRule', jsonb_build_object(
'parameterField', 'min',
'rule', 'GREATER_THAN_OR_EQUALS'
)
)
)
)
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', ''
),
'customLogoConfig', jsonb_build_object(
'customLogoUrlPath', (json ->> 'customLogoUrlPath'),
'customFaviconUrlPath', (json ->> 'customFaviconUrlPath'),
'customMonogramUrlPath', (json ->> 'customMonogramUrlPath')
)
)
WHERE configType = 'customLogoConfiguration';