Repository navigation
Description
Problem
The ER diagram exports one format: Export as PNG, a bitmap at twice screen resolution, and Cmd+C copies the same image (features/er-diagram.mdx:69-73, apple/TablePro/Views/ERDiagram/ERDiagramView.swift:115-128).
A bitmap blurs when a document or slide scales it, its text cannot be searched, and it cannot be diffed or edited. A schema diagram meant for a README, a design document or a pull request needs a vector file, or a text format that renders where it lands: Mermaid renders in GitHub Markdown, and Graphviz DOT feeds documentation builds.
Proposed solution
- The toolbar's export button becomes a menu: PNG (as today), SVG, PDF, Mermaid and Graphviz DOT, plus Copy as Mermaid for pasting into Markdown.
- SVG and PDF are vector, drawn from the layout the window shows: saved node positions, header colors and crow's foot markers, with text kept as text. A PDF is one page sized to the diagram.
- Mermaid writes an
erDiagramblock: each table with its columns, types andPKandFKmarkers, and each foreign key as a relationship carrying the cardinality the diagram already infers (features/er-diagram.mdx:29-34). - DOT writes each table as an HTML-like label with one row per column, and each foreign key as an edge between the two column ports, with Graphviz's
crow,teeandodotarrowheads for the cardinality. - Every format exports what the view shows: compact mode and the junction table setting carry over, as they do into the PNG today.
- The text formats list tables and columns in a stable order, so exporting an unchanged schema twice gives the same file and a diff shows only real changes.
Done when: for a 30-table schema, the SVG and PDF open in Preview and a browser, the Mermaid block renders in a GitHub comment, and dot -Tsvg renders the DOT file, each with every table and foreign key.
Alternatives considered
Export the PNG, or write the Mermaid or DOT by hand from File > Export > Export Tables… with SQL structure.
Platform
macOS
Related database type
N/A / General
Activity
[-]Export the ER diagram to Graphviz DOT[/-][+]Export the ER diagram as SVG, PDF, Mermaid and Graphviz DOT[/+]