Skip to content

fix(OpenGraph Schema Icons): Backfill custom-node-icons table BED-7610#2497

Merged
sirisjo merged 4 commits intomainfrom
BED-7610
Mar 12, 2026
Merged

fix(OpenGraph Schema Icons): Backfill custom-node-icons table BED-7610#2497
sirisjo merged 4 commits intomainfrom
BED-7610

Conversation

@sirisjo
Copy link
Contributor

@sirisjo sirisjo commented Mar 11, 2026

Description

When fixing the schema upload logic to add icon definitions to the custom_node_kinds table, I missed that we also need to backfill the custom_node_kinds table with icon definitions that exist in the schema_node_kinds table before that change was made. This change adds a migration to do so.

Motivation and Context

Resolves BED-7610

Required so that existing OpenGraph schema icons will show up across the app without having to either re-upload the schema or use the custom-node-kinds API suite.

How Has This Been Tested?

Tested locally by uploading a schema, deleting the icons that are auto-added, and then running the migration to confirm they are re-populated.

Screenshots (optional):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Database Migrations

Checklist:

Summary by CodeRabbit

  • Chores
    • Database migration added to backfill and reconcile node kind icon settings, ensuring node types display correct visuals after upgrade.
    • Existing customizations are preserved or updated to avoid duplicates and keep mappings consistent across versions, minimizing visual regressions during rollout.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 1d3e9ff7-20a9-4af0-b4ef-3beb1a86f7be

📥 Commits

Reviewing files that changed from the base of the PR and between a6dd051 and 41e8b2c.

📒 Files selected for processing (1)
  • cmd/api/src/database/migration/migrations/v8.8.0.sql
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/api/src/database/migration/migrations/v8.8.0.sql

📝 Walkthrough

Walkthrough

Adds a PL/pgSQL backfill routine to the v8.8.0 migration that scans non-built-in schema_node_kinds for non-empty icons and conditionally inserts or updates corresponding rows in custom_node_kinds with JSON icon config and schema_node_kind_id mappings.

Changes

Cohort / File(s) Summary
Database Migration
cmd/api/src/database/migration/migrations/v8.8.0.sql
Appends a DO $$ PL/pgSQL block that iterates schema_node_kinds (filtered for non-built-in/displayKind and non-empty icons). For each record it inserts a new custom_node_kinds with JSON icon config if missing, or updates an existing row to set schema_node_kind_id and config when kind_name matches.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: backfilling the custom-node-icons table, includes the ticket reference (BED-7610), and is directly related to the migration file added.
Description check ✅ Passed The description includes all major sections: clear description of changes, motivation/context with ticket reference, testing methodology, change types selected, and a substantially completed checklist indicating prerequisites were met.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch BED-7610

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/api/src/database/migration/migrations/v8.8.0.sql`:
- Around line 100-106: The FOR loop is selecting rows from schema_node_kinds
without excluding soft-deleted entries, so modify the SELECT used by the FOR ...
IN to skip rows where schema_node_kinds.deleted_at IS NOT NULL (e.g., add "AND
schema_node_kinds.deleted_at IS NULL" to the WHERE clause) so that
schema_node_kind_record never represents a soft-deleted kind; keep the rest of
the logic (INSERT into custom_node_kinds and UPDATE of schema_node_kind_id)
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 7abb41f0-69a7-4bcd-8028-44b5970a8098

📥 Commits

Reviewing files that changed from the base of the PR and between 4e3a29e and eed3608.

📒 Files selected for processing (1)
  • cmd/api/src/database/migration/migrations/v8.8.0.sql

Copy link
Member

@AD7ZJ AD7ZJ left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/api/src/database/migration/migrations/v8.8.0.sql`:
- Around line 118-124: The current migration overwrites custom_node_kinds.config
when a row matches kind_name; instead, only set schema_node_kind_id for
pre-existing rows and leave config untouched. Modify the UPDATE for
custom_node_kinds (referencing table custom_node_kinds, columns
schema_node_kind_id and config, the kind_name match and schema_node_kind_record)
so it only assigns schema_node_kind_id = schema_node_kind_record.id and only for
rows that do not already have a schema_node_kind_id (e.g., add a WHERE ... AND
schema_node_kind_id IS NULL), keeping the INSERT branch unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: d25825a7-e5cb-4f01-831a-142f080bc15c

📥 Commits

Reviewing files that changed from the base of the PR and between fba12f1 and a6dd051.

📒 Files selected for processing (1)
  • cmd/api/src/database/migration/migrations/v8.8.0.sql

Copy link
Contributor

@mistahj67 mistahj67 left a comment

Choose a reason for hiding this comment

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

Code LGTM. Tested as well 🚀

@sirisjo sirisjo enabled auto-merge (squash) March 12, 2026 00:02
@sirisjo sirisjo merged commit 987fc27 into main Mar 12, 2026
13 checks passed
@sirisjo sirisjo deleted the BED-7610 branch March 12, 2026 00:04
@github-actions github-actions bot locked and limited conversation to collaborators Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants