ER Diagram
See the tables of a schema and their foreign-key relationships as an automatically arranged diagram.
The ER Diagram draws the tables of a schema and the foreign keys between them. It is laid out automatically, and you can rearrange, explore and export it.
Open the diagram
- Choose View ▸ ER Diagram (
⌥⌘E). - Or click the ER Diagram icon in the top bar of the workspace.
The diagram opens in its own window and remembers its size and position per connection. When the database has several schemas, use the schema picker to choose which one to draw.
Only tables are drawn. Views are not included.
Controls
| Control | Shortcut | Description |
|---|---|---|
| All Columns / Keys Only | — | Show every column, or only key columns. |
| Find table | — | Jump to a table by name. |
| Zoom Out | ⌘− | Zoom out. |
| Zoom to Fit | ⌘0 | Fit the whole diagram in the window. |
| Zoom In | ⌘+ | Zoom in. |
| Arrange Automatically | — | Re-run the automatic layout. |
| Reload | ⌘R | Read the schema again. |
| Export PNG… | — | Save the diagram as an image. |
Zoom ranges from 0.1× to 3×.
⌘0and⌘Ract on the diagram while its window has focus. In the workspace they toggle the sidebar and reload the table.
Interact with the diagram
- Click a table to highlight its relationships.
- Drag a table to move it.
- Drag the background to pan.
- Double-click a table to open it in the workspace.
Notation
- Relationships use crow's-foot notation.
- Primary key and foreign key columns are marked.
- Each table box shows up to 22 rows. Larger tables end with "+ N more columns".
The automatic layout arranges tables in layers that follow their foreign keys.
Export as PNG
Click Export PNG… and choose where to save. The image:
- Is rendered at 2× resolution.
- Is at most 16,000 pixels on its longest side.
- Uses the current appearance, light or dark.
