Opening an ER Diagram
Load Schema
Zequel loads all tables from the active database/schema and analyzes foreign key relationships.
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
Navigation
- Pan
- Zoom
- Select Nodes
Click and drag the background to pan around the diagram.
Table Navigation
Jump to a tableβs Data Grid view: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
Understanding Schema Structure
Understanding Schema Structure
Explore an unfamiliar database by visualizing how tables relate to each other. Ideal for onboarding new developers.
Planning Queries
Planning Queries
Identify join paths before writing complex multi-table queries. See which foreign keys connect tables.
Database Documentation
Database Documentation
Export screenshots of the diagram for technical documentation, presentations, or wikis.
Schema Review
Schema Review
Review foreign key relationships during code reviews or database design sessions.
Exporting Diagrams
Save diagrams as images for documentation: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
Supported Databases
| Database | ER Diagram Support | Notes |
|---|---|---|
| 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
Diagram Not Loading
Diagram Not Loading
- Ensure the database connection is active
- Check that the active schema/database contains tables
- Refresh the connection if schema metadata is stale
Missing Foreign Keys
Missing Foreign Keys
- 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
Tables Overlapping
Tables Overlapping
- 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
Slow Performance
Slow Performance
- 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
Start with Small Schemas
Start with Small Schemas
Test the ER Diagram feature on databases with 10-50 tables before exploring massive schemas.
Use for Documentation
Use for Documentation
Capture diagram screenshots for README files, architectural decision records (ADRs), and onboarding guides.
Review Before Migrations
Review Before Migrations
Generate an ER diagram before and after schema migrations to verify foreign key relationships are preserved.
Identify Missing FKs
Identify Missing FKs
Use the diagram to spot tables that should have foreign keys but donβt. Missing edges indicate potential data integrity issues.