Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 23, 2025

This PR implements the "Add Related Tables" feature for the Schema Designer, providing functionality similar to SSMS Database Diagrams. Users can now right-click on any table in the Schema Designer and automatically add tables that have foreign key relationships with the selected table.

Feature Demo

Key Features

  • Automatic relationship discovery: Finds both parent tables (referenced by the selected table) and child tables (that reference the selected table)
  • Smart positioning: New tables are positioned to the right and below the selected table for optimal diagram layout
  • Duplicate prevention: Only adds tables that aren't already visible in the diagram
  • Relationship preservation: All foreign key relationships are maintained and visualized with connecting lines
  • Seamless integration: Follows existing UI patterns and includes proper state management

Implementation Details

Changes Made:

  1. Localization: Added addRelatedTables string constant for internationalization support
  2. Utility Function: Created tableUtils.getRelatedTables() to identify related tables via foreign key analysis
  3. Context Provider: Implemented addRelatedTables() method with intelligent table positioning logic
  4. UI Integration: Added new menu item to table context menu with appropriate icon

Technical Approach:

  • Minimal impact: Surgical changes that don't modify existing functionality
  • Type safety: Full TypeScript support with proper error handling
  • Performance: Efficient relationship discovery algorithm
  • Code quality: ESLint compliant and follows project conventions

Usage

  1. Open Schema Designer for any database
  2. Add a table to the diagram
  3. Right-click on the table to open context menu
  4. Select "Add Related Tables"
  5. Related tables will be automatically added and positioned appropriately

This enhancement significantly improves the user experience when working with complex database schemas by eliminating the need to manually search for and add related tables one by one.

Fixes #19809.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] [Feature Request]: "Add Related Tables" context menu for tables in Schema Designer Add "Add Related Tables" context menu option to Schema Designer Jul 23, 2025
@Copilot Copilot AI requested a review from aasimkhan30 July 23, 2025 08:23
Copilot finished work on behalf of aasimkhan30 July 23, 2025 08:23
@aasimkhan30 aasimkhan30 closed this Aug 7, 2025
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.

[Feature Request]: "Add Related Tables" context menu for tables in Schema Designer
2 participants