Move ontology/glossary relation migration from 1.14.0 back to 1.13.0#27431
Move ontology/glossary relation migration from 1.14.0 back to 1.13.0#27431sonika-shah merged 7 commits intomainfrom
Conversation
Ontology feature will ship in 1.13.0, not 1.14.0. Move the glossary term relation migrations (relationType backfill, settings insert, stale relatedTerms strip, conceptMappings backfill) back to the 1.13.0 postDataMigrationSQLScript for both MySQL and PostgreSQL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR moves the glossary term relation/ontology data migration steps from the 1.14.0 native migrations back into 1.13.0, aligning the DB migration timeline with the planned feature release in 1.13.0.
Changes:
- Removed the glossary relation post-data migration SQL from
bootstrap/sql/migrations/native/1.14.0(MySQL + PostgreSQL). - Added the same glossary relation migration steps into
bootstrap/sql/migrations/native/1.13.0/postDataMigrationSQLScript.sql(MySQL + PostgreSQL). - Eliminated the now-unused
1.14.0native migration directory content (and the directory no longer exists in the updated tree).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| bootstrap/sql/migrations/native/1.14.0/postgres/postDataMigrationSQLScript.sql | Removed glossary-relation post-data migration content (migration moved earlier). |
| bootstrap/sql/migrations/native/1.14.0/mysql/postDataMigrationSQLScript.sql | Removed glossary-relation post-data migration content (migration moved earlier). |
| bootstrap/sql/migrations/native/1.13.0/postgres/postDataMigrationSQLScript.sql | Added glossary term relation backfill/cleanup/settings insert steps to run in 1.13.0. |
| bootstrap/sql/migrations/native/1.13.0/mysql/postDataMigrationSQLScript.sql | Added glossary term relation backfill/cleanup/settings insert steps to run in 1.13.0. |
The V114 MigrationUtil.java package requires the 1.14.0 migration directory to exist with SQL files for the migration to be picked up. Keep them as empty files (matching convention of other versions with no post-data SQL). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add both schemaChanges.sql and postDataMigrationSQLScript.sql for mysql and postgres with a comment explaining the directory is required for the V114 Java migrations to be picked up by the migration framework. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code Review 👍 Approved with suggestions 0 resolved / 1 findingsMigration files for ontology and glossary relations are backported to version 1.13.0 as requested. Ensure trailing newlines are added to the end of both the PostgreSQL and MySQL scripts. 💡 Quality: Missing newline at end of both migration files📄 bootstrap/sql/migrations/native/1.13.0/postgres/postDataMigrationSQLScript.sql:88 📄 bootstrap/sql/migrations/native/1.13.0/mysql/postDataMigrationSQLScript.sql:86 Both the PostgreSQL (line 88) and MySQL (line 86) migration scripts are missing a trailing newline. This is indicated by the Suggested fix🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| -- Old data stored relatedTerms as EntityReference objects which fail to deserialize as TermRelation. | ||
| UPDATE glossary_term_entity | ||
| SET json = JSON_REMOVE(json, '$.relatedTerms') | ||
| WHERE JSON_EXTRACT(json, '$.relatedTerms') IS NOT NULL; |
There was a problem hiding this comment.
In MySQL, WHERE JSON_EXTRACT(json, '$.relatedTerms') IS NOT NULL will not match rows where relatedTerms exists but is JSON null, so the key won’t be removed (unlike the Postgres migration, which removes the key whenever it exists). To reliably strip the field whenever present, use a key-existence predicate (e.g., JSON_CONTAINS_PATH(json, 'one', '$.relatedTerms')) rather than checking the extracted value for NULL.
| WHERE JSON_EXTRACT(json, '$.relatedTerms') IS NOT NULL; | |
| WHERE JSON_CONTAINS_PATH(json, 'one', '$.relatedTerms'); |
| -- 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.
Postgres backfill for conceptMappings only checks json IS NULL OR json::jsonb->'conceptMappings' IS NULL. If the key exists but is explicitly set to JSON null, -> returns a JSON null value (not SQL NULL) and this condition won’t run, leaving conceptMappings as null. Consider also handling the JSON-null case so all existing terms end up with an array (e.g., treat JSON null the same as missing).
| WHERE json IS NULL OR json::jsonb->'conceptMappings' IS NULL; | |
| WHERE json IS NULL | |
| OR json::jsonb->'conceptMappings' IS NULL | |
| OR jsonb_typeof(json::jsonb->'conceptMappings') = 'null'; |
🟡 Playwright Results — all passed (30 flaky)✅ 3629 passed · ❌ 0 failed · 🟡 30 flaky · ⏭️ 89 skipped
🟡 30 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 |
…27431) * Move ontology/glossary relation migration from 1.14.0 back to 1.13.0 Ontology feature will ship in 1.13.0, not 1.14.0. Move the glossary term relation migrations (relationType backfill, settings insert, stale relatedTerms strip, conceptMappings backfill) back to the 1.13.0 postDataMigrationSQLScript for both MySQL and PostgreSQL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Restore empty 1.14.0 SQL migration files for Java migration framework The V114 MigrationUtil.java package requires the 1.14.0 migration directory to exist with SQL files for the migration to be picked up. Keep them as empty files (matching convention of other versions with no post-data SQL). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add schemaChanges.sql and comment all 1.14.0 SQL migration files Add both schemaChanges.sql and postDataMigrationSQLScript.sql for mysql and postgres with a comment explaining the directory is required for the V114 Java migrations to be picked up by the migration framework. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix missing trailing newline in postgres postDataMigrationSQLScript Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * address feedback --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com> (cherry picked from commit 077982c)
Summary
1.14.0back to1.13.0since the ontology feature will ship in 1.13.01.14.0migration directoryContext
The ontology migration was originally added in 1.13.0 (#25886), reverted, then moved to 1.14.0 (#26755). Since we're releasing in 1.13.0, this moves it back with all accumulated fixes (design system colors from #27142, stale relatedTerms strip from #26586).
Test plan