MINOR: dbt migration fix (#23980)

* fix: migration

* fix: playwright test DBT -> dbt
This commit is contained in:
Teddy 2025-10-23 12:54:34 +02:00 committed by GitHub
parent b5866df8bd
commit 30d0b0c04a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 41 additions and 38 deletions

View File

@ -6,15 +6,3 @@ SET json = JSON_ARRAY_INSERT(
)
WHERE JSON_CONTAINS(json->'$.supportedDataTypes', '"NUMBER"')
AND NOT JSON_CONTAINS(json->'$.supportedDataTypes', '"NUMERIC"');
UPDATE test_definition
SET json = JSON_SET(
json,
'$.testPlatforms',
CAST(REPLACE(
JSON_EXTRACT(json, '$.testPlatforms'),
'"DBT"',
'"dbt"'
) AS JSON)
)
WHERE JSON_CONTAINS(json, '"DBT"', '$.testPlatforms');

View File

@ -6,16 +6,4 @@ SET json = jsonb_set(
true
)
WHERE json->'supportedDataTypes' @> '"NUMBER"'::jsonb
AND NOT (json->'supportedDataTypes' @> '"NUMERIC"'::jsonb);
UPDATE test_definition
SET json = jsonb_set(
json::jsonb,
'{testPlatforms}',
REPLACE(
(json::jsonb -> 'testPlatforms')::text,
'"DBT"',
'"dbt"'
)::jsonb
)::json
WHERE json::jsonb -> 'testPlatforms' @> '"DBT"'::jsonb;
AND NOT (json->'supportedDataTypes' @> '"NUMERIC"'::jsonb);

View File

@ -0,0 +1,11 @@
UPDATE test_definition
SET json = JSON_SET(
json,
'$.testPlatforms',
CAST(REPLACE(
JSON_EXTRACT(json, '$.testPlatforms'),
'"DBT"',
'"dbt"'
) AS JSON)
)
WHERE JSON_CONTAINS(json, '"DBT"', '$.testPlatforms');

View File

@ -0,0 +1,11 @@
UPDATE test_definition
SET json = jsonb_set(
json::jsonb,
'{testPlatforms}',
REPLACE(
(json::jsonb -> 'testPlatforms')::text,
'"DBT"',
'"dbt"'
)::jsonb
)::json
WHERE json::jsonb -> 'testPlatforms' @> '"DBT"'::jsonb;

View File

@ -33,19 +33,24 @@ public class MigrationUtil {
}
offset += pageSize;
for (String json : jsons) {
TestCase testCase = JsonUtils.readValue(json, TestCase.class);
TestDefinition td = getTestDefinition(daoCollection, testCase);
if (Objects.nonNull(td) && Objects.equals(td.getName(), TABLE_DIFF)) {
LOG.debug("Adding caseSensitiveColumns=true table diff test case: {}", testCase.getId());
if (!hasCaseSensitiveColumnsParam(testCase.getParameterValues())) {
testCase
.getParameterValues()
.add(
new TestCaseParameterValue()
.withName("caseSensitiveColumns")
.withValue("true"));
try {
TestCase testCase = JsonUtils.readValue(json, TestCase.class);
TestDefinition td = getTestDefinition(daoCollection, testCase);
if (Objects.nonNull(td) && Objects.equals(td.getName(), TABLE_DIFF)) {
LOG.debug(
"Adding caseSensitiveColumns=true table diff test case: {}", testCase.getId());
if (!hasCaseSensitiveColumnsParam(testCase.getParameterValues())) {
testCase
.getParameterValues()
.add(
new TestCaseParameterValue()
.withName("caseSensitiveColumns")
.withValue("true"));
}
daoCollection.testCaseDAO().update(testCase);
}
daoCollection.testCaseDAO().update(testCase);
} catch (Exception e) {
LOG.error("Error migrating test definition: ", e);
}
}
}

View File

@ -1185,7 +1185,7 @@ test('TestCase filters', PLAYWRIGHT_INGESTION_TAG_OBJ, async ({ page }) => {
// Test case filter by platform
const testCasePlatformByDBT = page.waitForResponse(
`/api/v1/dataQuality/testCases/search/list?*testPlatforms=DBT*`
`/api/v1/dataQuality/testCases/search/list?*testPlatforms=dbt*`
);
await page.getByTestId('platform-select-filter').click();
await page.getByTitle('DBT').click();