mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
fix: Migrations - add operator parameter to test_definition for custom SQL queries in MySQL and Postgres (#21044)
(cherry picked from commit 49de0119cf696366f55ef9d4da7adf82f442d168)
This commit is contained in:
parent
d7bdc1bdc4
commit
890e0ee22c
@ -0,0 +1,18 @@
|
||||
UPDATE test_definition
|
||||
SET json = JSON_ARRAY_INSERT(
|
||||
json,
|
||||
'$.parameterDefinition[2]',
|
||||
JSON_OBJECT(
|
||||
'name', 'operator',
|
||||
'displayName', 'Operator',
|
||||
'description', 'Operator to use to compare the result of the custom SQL query to the threshold.',
|
||||
'dataType', 'STRING',
|
||||
'required', false,
|
||||
'optionValues', JSON_ARRAY('==', '>', '>=', '<', '<=', '!=')
|
||||
)
|
||||
)
|
||||
WHERE NOT JSON_CONTAINS(
|
||||
JSON_EXTRACT(json, '$.parameterDefinition[*].name'),
|
||||
JSON_QUOTE('operator')
|
||||
) AND name = 'tableCustomSQLQuery';
|
||||
|
@ -0,0 +1,20 @@
|
||||
UPDATE test_definition
|
||||
SET
|
||||
json = jsonb_insert(
|
||||
json,
|
||||
'{parameterDefinition, 2}',
|
||||
jsonb_build_object(
|
||||
'name', 'operator',
|
||||
'displayName', 'Operator',
|
||||
'description', 'Operator to use to compare the result of the custom SQL query to the threshold.',
|
||||
'dataType', 'STRING',
|
||||
'required', false,
|
||||
'optionValues', jsonb_build_array('==', '>', '>=', '<', '<=', '!=')
|
||||
)
|
||||
)
|
||||
WHERE
|
||||
name = 'tableCustomSQLQuery'
|
||||
AND NOT jsonb_path_exists(
|
||||
json,
|
||||
'$.parameterDefinition[*] ? (@.name == "operator")'
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user