v0.2.0: Database Migration ERD — installable CLI and compact cluster layouts
Database Migration ERD turns PostgreSQL migration SQL into readable SVG ER diagrams without a database connection. This release adds an installable CLI and measured cluster layout refinement for larger schemas.
Install
Requires Python 3.11+, pipx and D2 0.7.1 on PATH:
pipx install https://github.com/fightingBald/database-migration-erd/releases/download/v0.2.0/migration_erd-0.2.0-py3-none-any.whl
migration-erd ./migrations ./schema.svgThe existing python -m erd_generator entry point and copying the runtime under tools/erd-generator/ remain supported.
What stands out
- Local migration parsing: forward schema changes, sql-migrate/goose Up sections, supported dollar-quoted DO blocks, and ERD-neutral setup commands.
- Automatic grouping, colours, independent cluster placement and cross-group FK routing on top of D2/ELK; optional TALA support.
- Column types, composite/self-referencing foreign keys and index descriptions; optional YAML relationships and group overrides.
- SVG-only default output, in-memory candidate layouts, terminal-only diagnostics and preservation of the previous SVG on errors.
Reproducible layout example
Attached dummy-64.sql is fully fictional: 64 tables, 551 columns, 69 FKs and six automatically inferred groups. No layout YAML or manual positions are used. Compared with the tool's own native D2 baseline, the default result has 40.1% less canvas area and a 22.1% shorter longest connection. Distinct crossing locations rise from 3 to 12. This is one documented tradeoff, not a benchmark against other tools or a universal improvement guarantee.
See layout-before.svg, layout-after.svg and layout-metrics.json; PNG previews and SHA256SUMS are included. Full-size SVGs are best viewed in a browser.
Project website and workflow comparison · Developer guide and SQL limitations
This tool consumes supported SQL migrations. It does not apply migrations, execute procedural code, or replace database introspection for structures created through unsupported dynamic SQL.