OpenMetadata/bootstrap/sql/migrations/native/1.4.7/postgres/postDataMigrationSQLScript.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
443 B
MySQL
Raw Normal View History

-- Remove Duplicate FullyQualifiedName and lowercase
WITH cte AS (
SELECT
id,
ROW_NUMBER() OVER (PARTITION BY to_jsonb(LOWER(json->>'fullyQualifiedName')) ORDER BY id) as rn
FROM
user_entity
)
DELETE from user_entity
WHERE id IN (
SELECT id
FROM cte
WHERE rn > 1
);
UPDATE user_entity
SET json = jsonb_set(
json,
'{fullyQualifiedName}',
to_jsonb(LOWER(json->>'fullyQualifiedName'))
);