Skip to content

FK-aware inline grid navigation and schema-aware Add Row modal#214

Merged
kix007 merged 1 commit into
mainfrom
feat/fk-aware-grid-schema-addrow
Jun 4, 2026
Merged

FK-aware inline grid navigation and schema-aware Add Row modal#214
kix007 merged 1 commit into
mainfrom
feat/fk-aware-grid-schema-addrow

Conversation

@kix007
Copy link
Copy Markdown
Collaborator

@kix007 kix007 commented Jun 4, 2026

FK-aware inline grid navigation and schema-aware Add Row modal

Added

  • FK columns render as styled link cells with navigation icon to jump to referenced table
  • Schema-aware Add Row modal with NOT NULL validation, FK searchable dropdowns, smart defaults
  • Type-inferred column headers (123, A·Z, 🕑, {}, bool, 01) with PK/FK indicator suffixes
  • FK metadata auto-loaded after SELECT queries and cached per schema.table

Changed

  • PostgreSQL FK introspection switched from information_schema to pg_catalog.pg_constraint
  • Webview right-click context menu re-enabled

Removed

Other

  • Changelog updated

Summary by CodeRabbit

Release Notes

  • New Features

    • FK-aware inline navigation in results grid with clickable foreign-key cells
    • Schema-driven Add Row modal with validation for required/nullable fields and FK dropdowns
    • Type-inferred column headers with PK/FK indicators and tooltips showing type, nullability, defaults, and references
    • Automatic foreign-key metadata loading after SELECT queries
  • Improvements

    • Compact ER diagrams by default (PK/FK columns only)
    • Re-enabled right-click context menu in WebView

- FK columns render as styled link cells with navigation icon to jump to
  the referenced table row (DBeaver-style)
- Schema-aware Add Row modal with NOT NULL validation, FK searchable
  dropdowns, and smart column defaults
- Type-inferred column headers (123, A·Z, 🕑, {}, bool, 01) with PK/FK
  indicator suffixes
- FK metadata auto-loaded after SELECT queries (all engines) and
  cached per schema.table
- PostgreSQL FK introspection switched to pg_catalog.pg_constraint for
  cross-schema/composite FK support
- Webview right-click context menu re-enabled
- Roadmap cleaned up: #49, #52, #53 removed as addressed
- Changelog updated
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
queryden Ready Ready Preview, Comment Jun 4, 2026 3:13pm

@kix007 kix007 merged commit 17c9b47 into main Jun 4, 2026
9 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 42534ac0-76f8-4af5-bdaa-dd782e8d24b0

📥 Commits

Reviewing files that changed from the base of the PR and between beaa8ad and 855b795.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • src/components/explorer/DatabaseExplorer.tsx
  • src/components/layout/MainContent.tsx
  • src/components/results/ResultsPanel.tsx
  • src/components/tools/AddRowModal.tsx
  • src/components/ui/GridView.tsx
  • src/components/ui/fields/SchemaAwareField.tsx
  • website/src/pages/roadmap.astro

📝 Walkthrough

Walkthrough

This PR introduces comprehensive foreign-key metadata support, enabling FK-aware form validation, inline grid navigation, and schema-driven row creation. It upgrades PostgreSQL FK introspection to use pg_catalog, adds automatic metadata loading after queries, enhances the grid with type-inferred headers and FK dropdowns, and updates the row creation modal with schema-driven validation and default pre-fill.

Changes

Schema-Aware Foreign Key Metadata Feature

Layer / File(s) Summary
PostgreSQL FK Query Upgrade
src/components/explorer/DatabaseExplorer.tsx
FK introspection switches from information_schema to pg_catalog.pg_constraint for Postgres/Supabase/Cockroach. Table click and "Select Top 100" CustomEvent payloads now include tableSchema: details alongside columnTypes for downstream consumption.
FK Metadata Infrastructure
src/components/layout/MainContent.tsx
Adds tableSchema state and fkCacheRef cache; implements loadFKOptions for FK dropdown queries with DB-specific syntax; loads FK metadata post-SELECT for all DB types (information_schema for Postgres/MySQL, PRAGMA for SQLite); clears stale tableSchema on table changes; routes FK cell clicks to handleFkCellClick for drill-down queries.
Schema-Driven Form Components
src/components/ui/fields/SchemaAwareField.tsx
New file exports ColumnMeta, FKMeta, FKOption types and implements SchemaAwareField component with type-based input selection (bool/date/datetime-local/time/number/textarea/fk/text). Includes BoolField for tri-state nullable booleans and FKField for async searchable FK dropdowns with debounce and stale-request handling.
Enhanced AddRowModal with Schema Validation
src/components/tools/AddRowModal.tsx
Transforms from string-list-based to schema-driven (ColumnMeta-based) row creation; validates required/nullable fields via violations set; initializes values from column defaults with special expression handling; coerces empty strings to null per type prefix; renders SchemaAwareField per column with error tracking; disables save and changes button label when required fields are missing.
Results Panel Integration
src/components/results/ResultsPanel.tsx
Extends ResultsPanelProps with tableSchema, loadFKOptions, and onFkCellClick. Forwards these to GridView for FK-aware rendering and to AddRowModal for schema-driven column definitions and FK dropdown population.
FK-Aware GridView with Custom Rendering
src/components/ui/GridView.tsx
Adds FK-aware cell rendering (link+icon for FK values, gray null placeholders), builds fkCols map from tableSchema, implements custom header canvas drawing with type-prefix color-coding, infers column types from names/values via helpers (inferFromColumnName, inferColumnType, getTypeHeaderPrefix). Inline editing via text input for FK cells and datetime-local for date columns; hover tooltips show type/nullability/default/FK target.
Documentation and Roadmap
CHANGELOG.md, website/src/pages/roadmap.astro
Changelog documents ER diagram compactness, pg_catalog FK switch, automatic FK loading, FK grid navigation, schema-aware AddRowModal, and enhanced header UX. Removes completed roadmap items: pgAdmin/DBeaver import, inline add-row in grid, and image thumbnails.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A rabbit hops through foreign keys so bright,
Building schema dropdowns, sorting left and right,
With type-aware fields that gently coerce,
And headers that prefix each column's traverse,
The grid now knows where each cell will roam! 🌿

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/fk-aware-grid-schema-addrow

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.

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.

2 participants