Skip to content

feat(er-diagram): connect relationship lines to their columns - #4715

Merged
datlechin merged 2 commits into
mainfrom
feat/er-column-level-edges
Nov 29, 2026
Merged

datlechin merged 2 commits into
mainfrom
feat/er-column-level-edges

Conversation

@datlechin

@datlechin datlechin commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Summary

  • A relationship line runs from the foreign key's row to the referenced row. Tables side by side join on the facing edges, stacked tables on their right edges.
  • A composite key is one relationship: its rows fan into one line on each table, with one cardinality (unique when the key holds the whole primary key or a unique index, optional when any column is nullable).
  • Hovering a line highlights the rows it joins on both tables and shows a help tag with the constraint name and its column pairs. Selecting a line keeps its rows highlighted.
  • New Connect to Columns toolbar toggle, on by default. Off, lines meet the table edges as before.
  • A row compact mode hides, and a collapsed junction's many-to-many line, meet the table at its name.
  • Two keys on the same rows, or a key dropped and added again under its name, get lines of their own.
  • EREdge is one constraint with ordered column pairs; the graph builder and the staged overlay share the grouping and the cardinality rule.
  • Deleting a key from the diagram no longer fails when SQLite spells the referenced table in another case, and editing a table no longer drops that key's line.
  • Editing a table no longer draws its key into another schema to a same-named table here.
  • A staged rename of a referenced column moves the lines of every table that reference it.
  • The suggested foreign key name and the name check count keys the diagram does not draw.
  • VoiceOver reads "1 table", "1 relationship", "1 column", counts a composite key once, and a key column says which column it references.
  • Mermaid writes one relationship per key, labeled with its columns. DOT keeps a line per column pair, now with the key's one cardinality.

Docs: TableProApp/docs#306

Changed on purpose: stagedCompositeKeyDrawsEachPair (now one edge), drawnBoundsCoverTheLoop (table mode), nestedLoopsStayOnTheCanvas (route bounds, both modes), and the accessibility summary and column value expectations.

Before
After
Before, dark
After, dark
After, a composite key selected

Test plan

  • New ERDiagramEdgeAnchorTests: row anchors, facing and stacked sides, the 30 pt layout gap, composite fan, hidden rows, adjacent self rows, parallel keys in both modes, export crop, tooltip regions, row tints.
  • ERDiagramGraphBuilderTests, ERDiagramStagedOverlayTests, ERDiagramSchemaEditsTests, ERDiagramViewModelMenuTests, ERDiagramAccessibilityTests, writer and theme tests: composite keys, SQLite spelling, cross-schema keys, referenced renames, undrawn names, plurals.
  • All 31 ER and join graph suites pass locally (299 tests).

Fixes #4711

@datlechin
datlechin merged commit 1b985e4 into main Nov 29, 2026
10 of 11 checks passed
@datlechin
datlechin deleted the feat/er-column-level-edges branch November 29, 2026 08:52
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: Column-level relationship connections in ER diagrams

1 participant