mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-25 09:28:23 +00:00
Fix entity_ext owner update query (#17493)
This commit is contained in:
parent
424a03f49c
commit
2a8ee41c38
@ -209,16 +209,13 @@ WHERE JSON_CONTAINS_PATH(json, 'one', '$.feedInfo.entitySpecificInfo.updatedOwne
|
||||
AND JSON_TYPE(JSON_EXTRACT(json, '$.feedInfo.entitySpecificInfo.updatedOwner')) <> 'ARRAY';
|
||||
|
||||
-- Update entity_extension to move owner to array
|
||||
UPDATE entity_extension
|
||||
SET json = JSON_SET(
|
||||
json,
|
||||
'$.owner',
|
||||
update entity_extension set json = JSON_SET(
|
||||
JSON_REMOVE(json, '$.owner'),
|
||||
'$.owners',
|
||||
JSON_ARRAY(
|
||||
JSON_EXTRACT(json, '$.owner')
|
||||
)
|
||||
)
|
||||
WHERE JSON_CONTAINS_PATH(json, 'one', '$.owner')
|
||||
AND JSON_TYPE(JSON_EXTRACT(json, '$.owner')) <> 'ARRAY';
|
||||
) where json -> '$.owner' is not null;
|
||||
|
||||
ALTER TABLE test_case MODIFY COLUMN `name` VARCHAR(512) GENERATED ALWAYS AS (json ->> '$.name') NOT NULL;
|
||||
|
||||
|
@ -191,15 +191,8 @@ WHERE jsonb_path_exists(json, '$.feedInfo.entitySpecificInfo.updatedOwner')
|
||||
AND jsonb_typeof(json->'feedInfo'->'entitySpecificInfo'->'updatedOwner') <> 'array';
|
||||
|
||||
-- Update entity_extension to move owner to array
|
||||
UPDATE entity_extension
|
||||
SET json = jsonb_set(
|
||||
json,
|
||||
'{owner}',
|
||||
to_jsonb(ARRAY[jsonb_path_query_first(json, '$.owner')])
|
||||
)
|
||||
WHERE jsonb_path_exists(json, '$.owner')
|
||||
AND jsonb_path_query_first(json, '$.owner ? (@ != null)') IS NOT null
|
||||
AND jsonb_typeof(json->'owner') <> 'array';
|
||||
update entity_extension set json = jsonb_set(json#-'{owner}', '{owners}',
|
||||
jsonb_build_array(json#>'{owner}')) where json #>> '{owner}' is not null;
|
||||
|
||||
ALTER TABLE test_case ALTER COLUMN name TYPE VARCHAR(512);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user