Skip to content

feat(visualizer): adds enums support to the visualizer#339

Closed
Rudra-Sankha-Sinhamahapatra wants to merge 19 commits intomainfrom
visualizer/enums
Closed

feat(visualizer): adds enums support to the visualizer#339
Rudra-Sankha-Sinhamahapatra wants to merge 19 commits intomainfrom
visualizer/enums

Conversation

@Rudra-Sankha-Sinhamahapatra
Copy link
Copy Markdown
Collaborator

@Rudra-Sankha-Sinhamahapatra Rudra-Sankha-Sinhamahapatra commented Feb 11, 2026

Description of Changes

  • What was changed?
    Added enums support to the visualizer
  • Why was it changed?
    so that enum field type shows on row and added enums card on visualizer
  • Any related issues or discussions?

Closes #338 (If applicable, delete this line if not)

Checklist

  • My changes are scoped and focused
  • I have tested the code locally

Notes to reviewer

Need to verify edgecases though

  • Are there any specific things the reviewer should focus on?
Screenshot 2026-02-11 at 9 09 42 PM

one enum with two tables

Screenshot 2026-02-12 at 12 59 19 AM

two different enums with same name for different tables

Screenshot 2026-02-12 at 1 01 15 AM

Copilot AI review requested due to automatic review settings February 11, 2026 15:42
@railway-app
Copy link
Copy Markdown

railway-app Bot commented Feb 11, 2026

This PR was not deployed automatically as @Rudra-Sankha-Sinhamahapatra does not have access to the Railway project.

In order to get automatic PR deploys, please add @Rudra-Sankha-Sinhamahapatra to your workspace on Railway.

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

Adds enum visualization support to the database visualizer so enum-typed columns can display their enum type and link to enum “nodes” in the graph (Issue #338).

Changes:

  • Fetch enums data alongside tables/columns/constraints in the visualizer route.
  • Extend graph generation to create enum nodes and enum-related edges.
  • Update the React Flow node renderer to display enum nodes differently and hide the enum “anchor” row.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
apps/desktop/src/routes/_protected/database/$id/visualizer/index.tsx Loads enums query data and passes it into layout generation.
apps/desktop/src/routes/_protected/database/$id/visualizer/-lib.ts Adds enum nodes + edges and uses enums to alter column type display.
apps/desktop/src/entities/connection/components/react-flow-node.tsx Renders enum nodes with a different icon/label and filters out the enum anchor row.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/desktop/src/routes/_protected/database/$id/visualizer/-lib.ts
Comment thread apps/desktop/src/routes/_protected/database/$id/visualizer/-lib.ts
Comment thread apps/desktop/src/routes/_protected/database/$id/visualizer/-lib.ts Outdated
Comment thread apps/desktop/src/routes/_protected/database/$id/visualizer/-lib.ts Outdated
Comment thread apps/desktop/src/entities/connection/components/react-flow-node.tsx Outdated
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/desktop/src/routes/_protected/database/$id/visualizer/-lib.ts Outdated
Comment thread apps/desktop/src/entities/connection/components/react-flow-node.tsx Outdated
Comment thread apps/desktop/src/routes/_protected/database/$id/visualizer/-lib.ts Outdated
Comment thread apps/desktop/src/entities/connection/components/react-flow-node.tsx
Comment thread apps/desktop/src/entities/connection/components/react-flow-node.tsx Outdated
Comment thread apps/desktop/src/routes/_protected/database/$id/visualizer/index.tsx Outdated
Comment thread apps/desktop/src/entities/connection/sql/enums.ts Outdated
Comment on lines +23 to +34
if (columns && enums && schema) {
const schemaEnums = enums.filter(e => e.schema === schema)

columns.forEach((c) => {
const enumDef = c.enum
? schemaEnums.find((e) => {
if (e.metadata?.table) {
return e.metadata.table === c.table && e.metadata.column === c.id
}

return e.id === c.enum || e.name === c.enum
})
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

getEdges iterates over all columns passed in, but it does not filter by schema. Since Visualizer passes columns from all schemas, this can create enum edges from tables in other schemas to enums in the currently selected schema (and potentially reference non-existent nodes). Filter constraints/columns to the current schema (and ideally to schemaTables) before building edges.

Copilot uses AI. Check for mistakes.
@letstri letstri closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add enums support to the visualizer

3 participants