mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-29 10:55:09 +00:00
Minor fix broken 1.9.8 migrations (#23487)
* chore: fix duplicate migrations from 1.9.8 * fix: psql update query
This commit is contained in:
parent
0d0bd5a632
commit
71f993a2fc
@ -0,0 +1,7 @@
|
|||||||
|
-- If you upgraded to 1.9.8 with the initial migration and then upgraded to 1.9.9
|
||||||
|
-- `'profileData', pdts.json` `pdts.json` will have the profileData in the json field
|
||||||
|
-- you will hence have performed the same migration again. This brings the json
|
||||||
|
-- `profileData`field back to the original state.
|
||||||
|
UPDATE profiler_data_time_series
|
||||||
|
SET json = JSON_SET(json, '$.profileData', json->'$.profileData.profileData')
|
||||||
|
WHERE json->>'$.profileData.profileData' IS NOT NULL;
|
@ -0,0 +1,7 @@
|
|||||||
|
-- If you upgraded to 1.9.8 with the initial migration and then upgraded to 1.9.9
|
||||||
|
-- `'profileData', pdts.json` `pdts.json` will have the profileData in the json field
|
||||||
|
-- you will hence have performed the same migration again. This brings the json
|
||||||
|
-- `profileData`field back to the original state.
|
||||||
|
UPDATE profiler_data_time_series
|
||||||
|
SET json = jsonb_set(json::jsonb, '{profileData}', json::jsonb->'profileData'->'profileData')::json
|
||||||
|
WHERE json->'profileData'->>'profileData' IS NOT NULL;
|
@ -28,7 +28,8 @@ SET pdts.json = JSON_OBJECT(
|
|||||||
'profileData', pdts.json,
|
'profileData', pdts.json,
|
||||||
'profileType', 'table'
|
'profileType', 'table'
|
||||||
)
|
)
|
||||||
WHERE pdts.extension = 'table.tableProfile';
|
WHERE pdts.extension = 'table.tableProfile'
|
||||||
|
AND pdts.json->>'$.profileData' IS NULL;
|
||||||
|
|
||||||
-- Migrate system profiles (direct match)
|
-- Migrate system profiles (direct match)
|
||||||
UPDATE profiler_data_time_series pdts
|
UPDATE profiler_data_time_series pdts
|
||||||
@ -45,7 +46,8 @@ SET pdts.json = JSON_OBJECT(
|
|||||||
'profileData', pdts.json,
|
'profileData', pdts.json,
|
||||||
'profileType', 'system'
|
'profileType', 'system'
|
||||||
)
|
)
|
||||||
WHERE pdts.extension = 'table.systemProfile';
|
WHERE pdts.extension = 'table.systemProfile'
|
||||||
|
AND pdts.json->>'$.profileData' IS NULL;
|
||||||
|
|
||||||
-- Migrate column profiles using temporary mapping table for better performance
|
-- Migrate column profiles using temporary mapping table for better performance
|
||||||
-- Create temporary mapping table to extract table hash from column hash
|
-- Create temporary mapping table to extract table hash from column hash
|
||||||
|
@ -33,7 +33,8 @@ SET json = jsonb_build_object(
|
|||||||
)
|
)
|
||||||
FROM table_entity te
|
FROM table_entity te
|
||||||
WHERE pdts.entityFQNHash = te.fqnHash
|
WHERE pdts.entityFQNHash = te.fqnHash
|
||||||
AND pdts.extension = 'table.tableProfile';
|
AND pdts.extension = 'table.tableProfile'
|
||||||
|
AND pdts.json->>'profileData' IS NULL;
|
||||||
|
|
||||||
-- Migrate system profiles (direct match)
|
-- Migrate system profiles (direct match)
|
||||||
UPDATE profiler_data_time_series pdts
|
UPDATE profiler_data_time_series pdts
|
||||||
@ -51,7 +52,8 @@ SET json = jsonb_build_object(
|
|||||||
)
|
)
|
||||||
FROM table_entity te
|
FROM table_entity te
|
||||||
WHERE pdts.entityFQNHash = te.fqnHash
|
WHERE pdts.entityFQNHash = te.fqnHash
|
||||||
AND pdts.extension = 'table.systemProfile';
|
AND pdts.extension = 'table.systemProfile'
|
||||||
|
AND pdts.json->>'profileData' IS NULL;
|
||||||
|
|
||||||
-- Migrate column profiles using temporary mapping table for better performance
|
-- Migrate column profiles using temporary mapping table for better performance
|
||||||
-- Use UNLOGGED table for memory-like performance (no WAL writes)
|
-- Use UNLOGGED table for memory-like performance (no WAL writes)
|
||||||
@ -95,7 +97,8 @@ SET json = jsonb_build_object(
|
|||||||
FROM column_to_table_mapping ctm
|
FROM column_to_table_mapping ctm
|
||||||
INNER JOIN table_entity te ON ctm.table_hash = te.fqnHash
|
INNER JOIN table_entity te ON ctm.table_hash = te.fqnHash
|
||||||
WHERE pdts.entityFQNHash = ctm.column_hash
|
WHERE pdts.entityFQNHash = ctm.column_hash
|
||||||
AND pdts.extension = 'table.columnProfile';
|
AND pdts.extension = 'table.columnProfile'
|
||||||
|
AND pdts.json->>'profileData' IS NULL;
|
||||||
|
|
||||||
-- Clean up temporary table
|
-- Clean up temporary table
|
||||||
DROP TABLE IF EXISTS column_to_table_mapping;
|
DROP TABLE IF EXISTS column_to_table_mapping;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user