Repository navigation
Description
Problem
The ER diagram is read-only. A click selects a table and a drag moves it, and that is all (apple/TablePro/Views/ERDiagram/ERDiagramSceneView.swift, apple/TablePro/ViewModels/ERDiagramViewModel.swift). There is no context menu, no way to open a table from its node, and no way to change a relationship. The diagram is also a snapshot taken when the tab opens, so after a schema change it has to be closed and opened again (features/er-diagram.mdx:21).
Schema design happens in the diagram, where the relationships are visible, but every change has to be made somewhere else: a foreign key in the table's Structure tab, a new table in the New Table tab, then the diagram reopened to check the result.
Proposed solution
- Right-click a table node for Open Table, Open Structure and Copy Name; double-click opens the table.
- Drag from a column to a column in another table to add a foreign key. A small sheet confirms the columns, the constraint name and the
ON DELETEandON UPDATEactions. - Select an edge and press
Deleteto drop that foreign key. - Add, rename and drop columns from a table node, through the same column grid the Structure tab uses.
- New Table on the canvas opens the existing New Table tab, and the created table lands where it was asked for.
- Every edit joins one queue with the same Preview SQL (
Cmd+Shift+P) and Save Changes (Cmd+S) as the Structure tab (features/table-structure.mdx:213-222), built by the same SQL generator, so each engine's rules hold: a SQLite rebuild is reviewed first, and an engine that cannot edit foreign keys dims the action with the reason. Safe Mode applies as it does to any structure change. - After a save, the diagram reloads the changed tables and keeps every node's position. A Refresh button does the same after a change made elsewhere.
Done when: on PostgreSQL, MySQL and SQLite, adding a foreign key, dropping one and adding a column from the diagram produce the same statements the Structure tab produces for the same change.
Alternatives considered
Make the change in each table's Structure tab, then close and reopen the diagram.
Platform
macOS
Related database type
N/A / General
Activity