Move ontology/glossary relation migration from 1.13.0 to 1.14.0#26755
Move ontology/glossary relation migration from 1.13.0 to 1.14.0#26755
Conversation
The glossary term relation migration (relationType backfill, default glossaryTermRelationSettings insert, relatedTerms cleanup, conceptMappings backfill) was accidentally placed in the 1.13.0 migration scripts. This commit moves it to the correct 1.14.0 slot, restoring 1.13.0 to its original content (computeMetrics profiler pipeline cleanup only). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ ApprovedMoves ontology/glossary relation migration from version 1.13.0 to 1.14.0. No issues found. OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
There was a problem hiding this comment.
Pull request overview
This PR corrects the version placement of the glossary term relation / ontology migration by moving it out of the 1.13.0 native post-data scripts and into the 1.14.0 slot, leaving 1.13.0 with only the intended profiler computeMetrics cleanup.
Changes:
- Add glossary term relation backfill + settings insert + JSON cleanup + conceptMappings backfill to 1.14.0 (MySQL/Postgres).
- Remove the same glossary/ontology migration statements from 1.13.0 (MySQL/Postgres), restoring 1.13.0’s original scope.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| bootstrap/sql/migrations/native/1.14.0/postgres/postDataMigrationSQLScript.sql | Adds the glossary term relation migration and related JSON cleanups/backfills to Postgres 1.14.0. |
| bootstrap/sql/migrations/native/1.14.0/mysql/postDataMigrationSQLScript.sql | Adds the glossary term relation migration and related JSON cleanups/backfills to MySQL 1.14.0. |
| bootstrap/sql/migrations/native/1.13.0/postgres/postDataMigrationSQLScript.sql | Removes the glossary/ontology migration content, keeping only profiler cleanup. |
| bootstrap/sql/migrations/native/1.13.0/mysql/postDataMigrationSQLScript.sql | Removes the glossary/ontology migration content, keeping only profiler cleanup. |
| WHERE fromEntity = 'glossaryTerm' | ||
| AND toEntity = 'glossaryTerm' | ||
| AND relation = 15 | ||
| AND (json IS NULL OR JSON_EXTRACT(json, '$.relationType') IS NULL); |
There was a problem hiding this comment.
In MySQL, JSON_EXTRACT(json, '$.relationType') IS NULL only matches missing paths / SQL NULL, but not an explicit JSON null value. If any existing relationship rows have { "relationType": null }, this migration will skip them and leave a non-string relationType behind. Consider extending the predicate to also treat JSON null as missing (e.g., via JSON_TYPE(JSON_EXTRACT(...)) = 'NULL').
| AND (json IS NULL OR JSON_EXTRACT(json, '$.relationType') IS NULL); | |
| AND ( | |
| json IS NULL | |
| OR JSON_EXTRACT(json, '$.relationType') IS NULL | |
| OR JSON_TYPE(JSON_EXTRACT(json, '$.relationType')) = 'NULL' | |
| ); |
| -- Backfill conceptMappings for existing glossary terms | ||
| UPDATE glossary_term_entity | ||
| SET json = JSON_SET(COALESCE(json, '{}'), '$.conceptMappings', JSON_ARRAY()) | ||
| WHERE JSON_EXTRACT(json, '$.conceptMappings') IS NULL; |
There was a problem hiding this comment.
WHERE JSON_EXTRACT(json, '$.conceptMappings') IS NULL won’t match rows where conceptMappings exists but is explicitly JSON null. If those exist, they’ll remain null instead of being backfilled to an array, which can still break deserialization expecting a list. Consider checking JSON_TYPE(JSON_EXTRACT(...)) = 'NULL' as well.
| WHERE JSON_EXTRACT(json, '$.conceptMappings') IS NULL; | |
| WHERE JSON_EXTRACT(json, '$.conceptMappings') IS NULL | |
| OR JSON_TYPE(JSON_EXTRACT(json, '$.conceptMappings')) = 'NULL'; |
| -- Backfill conceptMappings for existing glossary terms | ||
| UPDATE glossary_term_entity | ||
| SET json = jsonb_set(COALESCE(json::jsonb, '{}'::jsonb), '{conceptMappings}', '[]'::jsonb) | ||
| WHERE json IS NULL OR json::jsonb->'conceptMappings' IS NULL; |
There was a problem hiding this comment.
json::jsonb->'conceptMappings' IS NULL only catches missing keys, not keys present with an explicit JSON null (in that case the expression is 'null'::jsonb, not SQL NULL). If any glossary terms have "conceptMappings": null, they won’t be backfilled to []. Consider expanding the WHERE clause to also match json::jsonb->'conceptMappings' = 'null'::jsonb (see existing migrations that handle JSON null explicitly).
| WHERE json IS NULL OR json::jsonb->'conceptMappings' IS NULL; | |
| WHERE json IS NULL | |
| OR json::jsonb->'conceptMappings' IS NULL | |
| OR json::jsonb->'conceptMappings' = 'null'::jsonb; |
| -- relatedTerms is now loaded from entity_relationship table, not from entity JSON. | ||
| -- Old data stored relatedTerms as EntityReference objects which fail to deserialize as TermRelation. | ||
| UPDATE glossary_term_entity | ||
| SET json = (json::jsonb - 'relatedTerms')::json |
There was a problem hiding this comment.
SET json = (json::jsonb - 'relatedTerms')::json casts the result to json even though glossary_term_entity.json is a jsonb column. This works via implicit casts, but adds unnecessary type conversion and is inconsistent with the other jsonb_* usage in this script. Consider keeping the expression as jsonb to avoid extra casting.
| SET json = (json::jsonb - 'relatedTerms')::json | |
| SET json = json::jsonb - 'relatedTerms' |
OpenMetadata Service New-Code Coverage✅ No changed production Java files under |
🟡 Playwright Results — all passed (25 flaky)✅ 3406 passed · ❌ 0 failed · 🟡 25 flaky · ⏭️ 209 skipped
🟡 25 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
The glossary term relation migration (relationType backfill, default glossaryTermRelationSettings insert, relatedTerms cleanup, conceptMappings backfill) was accidentally placed in the 1.13.0 migration scripts. This commit moves it to the correct 1.14.0 slot, restoring 1.13.0 to its original content (computeMetrics profiler pipeline cleanup only).
Describe your changes:
Fixes
Move Ontology Migration to 1.14
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>