fix: move migration to 1.3.1 (#15463)

This commit is contained in:
Teddy 2024-03-05 15:30:43 +01:00 committed by GitHub
parent 70e1643bd8
commit 6536ce7c94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 26 deletions

View File

@ -0,0 +1,13 @@
-- Update the relation between testDefinition and testCase to 0 (CONTAINS)
UPDATE entity_relationship
SET relation = 0
WHERE fromEntity = 'testDefinition' AND toEntity = 'testCase' AND relation != 0;
-- Update the test definition provider
-- If the test definition has OpenMetadata as a test platform, then the provider is system, else it is user
UPDATE test_definition
SET json = CASE
WHEN JSON_CONTAINS(json, '"OpenMetadata"', '$.testPlatforms') THEN JSON_INSERT(json,'$.provider','system')
ELSE JSON_INSERT(json,'$.provider','user')
END
;

View File

@ -0,0 +1,13 @@
-- Update the relation between testDefinition and testCase to 0 (CONTAINS)
UPDATE entity_relationship
SET relation = 0
WHERE fromEntity = 'testDefinition' AND toEntity = 'testCase' AND relation != 0;
-- Update the test definition provider
-- If the test definition has OpenMetadata as a test platform, then the provider is system, else it is user
UPDATE test_definition
SET json =
case
when json->'testPlatforms' @> '"OpenMetadata"' then jsonb_set(json,'{provider}','"system"',true)
else jsonb_set(json,'{provider}','"user"', true)
end;

View File

@ -1,13 +0,0 @@
-- Update the relation between testDefinition and testCase to 0 (CONTAINS)
UPDATE entity_relationship
SET relation = 0
WHERE fromEntity = 'testDefinition' AND toEntity = 'testCase' AND relation != 0;
-- Update the test definition provider
-- If the test definition has OpenMetadata as a test platform, then the provider is system, else it is user
UPDATE test_definition
SET json = CASE
WHEN JSON_CONTAINS(json, '"OpenMetadata"', '$.testPlatforms') THEN JSON_INSERT(json,'$.provider','system')
ELSE JSON_INSERT(json,'$.provider','user')
END
;

View File

@ -1,13 +0,0 @@
-- Update the relation between testDefinition and testCase to 0 (CONTAINS)
UPDATE entity_relationship
SET relation = 0
WHERE fromEntity = 'testDefinition' AND toEntity = 'testCase' AND relation != 0;
-- Update the test definition provider
-- If the test definition has OpenMetadata as a test platform, then the provider is system, else it is user
UPDATE test_definition
SET json =
case
when json->'testPlatforms' @> '"OpenMetadata"' then jsonb_set(json,'{provider}','"system"',true)
else jsonb_set(json,'{provider}','"user"', true)
end;