Skip to content

Move ontology/glossary relation migration from 1.13.0 to 1.14.0#26755

Merged
yan-3005 merged 1 commit intomainfrom
ram/ontology-migration-1.14
Mar 25, 2026
Merged

Move ontology/glossary relation migration from 1.13.0 to 1.14.0#26755
yan-3005 merged 1 commit intomainfrom
ram/ontology-migration-1.14

Conversation

@yan-3005
Copy link
Copy Markdown
Contributor

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:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

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>
@yan-3005 yan-3005 self-assigned this Mar 25, 2026
Copilot AI review requested due to automatic review settings March 25, 2026 05:07
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot
Copy link
Copy Markdown

gitar-bot bot commented Mar 25, 2026

Code Review ✅ Approved

Moves ontology/glossary relation migration from version 1.13.0 to 1.14.0. No issues found.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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').

Suggested change
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'
);

Copilot uses AI. Check for mistakes.
-- 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;
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
WHERE JSON_EXTRACT(json, '$.conceptMappings') IS NULL;
WHERE JSON_EXTRACT(json, '$.conceptMappings') IS NULL
OR JSON_TYPE(JSON_EXTRACT(json, '$.conceptMappings')) = 'NULL';

Copilot uses AI. Check for mistakes.
-- 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;
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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;

Copilot uses AI. Check for mistakes.
-- 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
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
SET json = (json::jsonb - 'relatedTerms')::json
SET json = json::jsonb - 'relatedTerms'

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

OpenMetadata Service New-Code Coverage

✅ No changed production Java files under openmetadata-service/src/main/java. Coverage gate skipped.

@github-actions
Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (25 flaky)

✅ 3406 passed · ❌ 0 failed · 🟡 25 flaky · ⏭️ 209 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 448 0 7 2
🟡 Shard 2 598 0 7 32
🟡 Shard 3 612 0 3 28
🟡 Shard 4 599 0 4 47
✅ Shard 5 587 0 0 67
🟡 Shard 6 562 0 4 33
🟡 25 flaky test(s) (passed on retry)
  • Features/DataAssetRulesDisabled.spec.ts › Verify the ApiEndpoint entity item action after rules disabled (shard 1, 1 retry)
  • Features/DataAssetRulesDisabled.spec.ts › Verify the DashboardDataModel entity item action after rules disabled (shard 1, 1 retry)
  • Features/CustomizeDetailPage.spec.ts › Domain - customization should work (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from help section (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from welcome screen (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from URL directly (shard 1, 1 retry)
  • Pages/UserCreationWithPersona.spec.ts › Create user with persona and verify on profile (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Database Schema (shard 2, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Database service (shard 2, 1 retry)
  • Features/CuratedAssets.spec.ts › Test Topics with display name filter (shard 2, 1 retry)
  • Features/DataQuality/DataQuality.spec.ts › TestCase with Array params value (shard 2, 1 retry)
  • Features/DataQuality/DataQualityPermissions.spec.ts › User with TEST_CASE.VIEW_BASIC can view test case CONTENT details in UI (shard 2, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should cancel drag and drop operation (shard 2, 1 retry)
  • Features/Permissions/GlossaryPermissions.spec.ts › Team-based permissions work correctly (shard 3, 1 retry)
  • Flow/CustomizeWidgets.spec.ts › Total Data Assets Widget (shard 3, 1 retry)
  • Flow/ExploreDiscovery.spec.ts › Should display deleted assets when showDeleted is checked and deleted is not present in queryFilter (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Table (shard 4, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Description Rule Is_Not_Set (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Inactive Announcement create & delete (shard 4, 1 retry)
  • Pages/HyperlinkCustomProperty.spec.ts › should accept valid http and https URLs (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Multi-object ODCS contract - object selector shows all schema objects (shard 6, 1 retry)
  • Pages/ServiceEntity.spec.ts › Inactive Announcement create & delete (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@yan-3005 yan-3005 merged commit 10cf2f9 into main Mar 25, 2026
55 of 85 checks passed
@yan-3005 yan-3005 deleted the ram/ontology-migration-1.14 branch March 25, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants