Skip to main content
ER Diagrams provide a visual representation of your database schema, showing tables, columns, and foreign key relationships. Zequel automatically generates diagrams using hierarchical layout algorithms for clarity.

Opening an ER Diagram

1

Create Diagram Tab

Click the ER Diagram button in the sidebar or use the connection context menu.
2

Load Schema

Zequel loads all tables from the active database/schema and analyzes foreign key relationships.
3

View Diagram

The diagram appears with tables as nodes and foreign keys as connecting edges.
ER Diagrams are available for PostgreSQL, MySQL, MariaDB, SQLite, DuckDB, and SQL Server. NoSQL databases (MongoDB, Redis) and ClickHouse do not support foreign keys.

Diagram Layout

Automatic Positioning

Zequel uses the ELK (Eclipse Layout Kernel) algorithm to position tables:
  • Hierarchical Layout: Tables are arranged left-to-right based on dependencies
  • Edge Crossing Minimization: Foreign key lines minimize crossings for readability
  • Connected Components: Related table groups are positioned close together
  • Orthogonal Routing: Edges use right-angle bends (standard for ER diagrams)

Node Structure

Each table node displays:
  • Table Name: Bold header at the top
  • Column List: All columns with data types
  • Primary Key Icon: πŸ”‘ next to primary key columns
  • Foreign Key Icon: πŸ”— next to foreign key columns
  • Referenced Column Icon: πŸ“Œ next to columns referenced by other tables

Edge Types

Foreign key relationships are shown as directed edges:
  • Arrow Direction: Points from the foreign key column to the referenced column
  • Edge Color: Matches the app theme (light/dark mode)
  • Hover Highlight: Edges highlight on hover for clarity

Interacting with the Diagram

Click and drag the background to pan around the diagram.

Table Navigation

Jump to a table’s Data Grid view:
1

Click Table Node

Click any table in the diagram.
2

Open Table

A new tab opens showing the table’s data in the Data Grid.
3

Return to Diagram

Switch back to the ER Diagram tab to continue exploring.

Diagram Controls

Zoom Controls

Located in the bottom-right corner:
  • Zoom In (+): Increase zoom level
  • Zoom Out (-): Decrease zoom level
  • Fit View: Auto-scale to show all tables
  • 1:1: Reset to 100% zoom

Background Grid

The diagram displays a subtle dot grid:
  • Purpose: Helps visualize spacing and alignment
  • Variant: Dots in light mode, subtle lines in dark mode
  • Toggle: Disable in Settings β†’ Diagram Settings (future feature)

Use Cases

Explore an unfamiliar database by visualizing how tables relate to each other. Ideal for onboarding new developers.
Identify join paths before writing complex multi-table queries. See which foreign keys connect tables.
Export screenshots of the diagram for technical documentation, presentations, or wikis.
Review foreign key relationships during code reviews or database design sessions.

Exporting Diagrams

Save diagrams as images for documentation:
1

Screenshot

Use macOS screenshot tools (Cmd+Shift+4) to capture the diagram area.
2

Save Image

Save as PNG or JPG for embedding in docs, Notion, Confluence, etc.
Future versions will include built-in export to SVG, PNG, and PDF formats.

Diagram Performance

Large Schemas

For databases with hundreds of tables:
  • Loading Time: Initial load may take 5-10 seconds as Zequel fetches all table metadata
  • Rendering: ELK layout computation is performed in the background
  • Virtual Rendering: Only visible nodes are rendered for performance
Diagrams with 200+ tables may become difficult to read. Consider filtering to show only related table groups (future feature).

Supported Databases

DatabaseER Diagram SupportNotes
PostgreSQLβœ…Full support with schema selection
MySQLβœ…Includes views as nodes
MariaDBβœ…Same as MySQL
SQLiteβœ…Foreign keys supported (if enabled)
DuckDBβœ…Limited FK support
SQL Serverβœ…Full support
MongoDB❌No foreign keys (document database)
Redis❌No foreign keys (key-value store)
ClickHouse❌No foreign keys (analytical database)

Troubleshooting

  • Ensure the database connection is active
  • Check that the active schema/database contains tables
  • Refresh the connection if schema metadata is stale
  • For SQLite, ensure foreign keys are enabled: PRAGMA foreign_keys = ON;
  • Check that foreign key constraints exist in the database schema
  • Verify the database type supports foreign keys
  • Click Fit View to re-center and scale the diagram
  • Zoom in to see individual table details
  • Large schemas may require manual panning to explore all nodes
  • Diagrams with 100+ tables may take time to render
  • Close other tabs to free up memory
  • Consider filtering the schema to show only relevant tables (future feature)

Best Practices

Test the ER Diagram feature on databases with 10-50 tables before exploring massive schemas.
Capture diagram screenshots for README files, architectural decision records (ADRs), and onboarding guides.
Generate an ER diagram before and after schema migrations to verify foreign key relationships are preserved.
Use the diagram to spot tables that should have foreign keys but don’t. Missing edges indicate potential data integrity issues.

Build docs developers (and LLMs) love