diff --git a/bootstrap/sql/migrations/native/1.3.1/mysql/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.3.1/mysql/postDataMigrationSQLScript.sql index e69de29bb2d..a3693db8f6a 100644 --- a/bootstrap/sql/migrations/native/1.3.1/mysql/postDataMigrationSQLScript.sql +++ b/bootstrap/sql/migrations/native/1.3.1/mysql/postDataMigrationSQLScript.sql @@ -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 +; diff --git a/bootstrap/sql/migrations/native/1.3.1/postgres/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.3.1/postgres/postDataMigrationSQLScript.sql index e69de29bb2d..dca6c0b7e3e 100644 --- a/bootstrap/sql/migrations/native/1.3.1/postgres/postDataMigrationSQLScript.sql +++ b/bootstrap/sql/migrations/native/1.3.1/postgres/postDataMigrationSQLScript.sql @@ -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; diff --git a/bootstrap/sql/migrations/native/1.4.0/mysql/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.4.0/mysql/postDataMigrationSQLScript.sql index a3693db8f6a..e69de29bb2d 100644 --- a/bootstrap/sql/migrations/native/1.4.0/mysql/postDataMigrationSQLScript.sql +++ b/bootstrap/sql/migrations/native/1.4.0/mysql/postDataMigrationSQLScript.sql @@ -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 -; diff --git a/bootstrap/sql/migrations/native/1.4.0/postgres/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.4.0/postgres/postDataMigrationSQLScript.sql index dca6c0b7e3e..e69de29bb2d 100644 --- a/bootstrap/sql/migrations/native/1.4.0/postgres/postDataMigrationSQLScript.sql +++ b/bootstrap/sql/migrations/native/1.4.0/postgres/postDataMigrationSQLScript.sql @@ -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;