Read a SQL schema as a diagram
Paste a CREATE TABLE script — a migration, a
pg_dump, a file from a codebase you did not write — and get
an entity-relationship diagram you can pan, zoom and edit. It runs
entirely in your browser. Nothing is uploaded.
The SQL is the document
Most diagram tools import your schema into a model of their own, and from then on you have two copies that drift. draft keeps one. The diagram is a projection of the text, and editing the diagram rewrites the exact bytes of your script.
Rename a table on the canvas and every REFERENCES and key
clause that mentions it is updated in place. Your comments, your blank
lines, your vendor-specific clauses the parser never even understood —
all still there, byte for byte, because nothing outside the span being
changed is ever touched.
What it does
- Automatic layout, tuned so a wide schema folds into something a screen can hold instead of a ribbon.
- Pan, zoom and level of detail; hover a table to fade everything it is not connected to.
- Drag tables where you want them; they stay put.
- A syntax-highlighted SQL pane beside the diagram, which redraws as you type.
- Two-way editing: double-click a table name, column name or type and change it.
- Sticky notes and group boxes, for the things the schema does not say.
- Save a project as one JSON file, or copy a link that carries the whole thing.
- Open a schema straight from a URL: paste a raw
.sqllink, or put it in one. - Export SVG, PNG or WebP for a document or a pull request.
Nothing is uploaded
There is no server to upload to. The parser, the layout engine and the
renderer are compiled to WebAssembly and run in your tab. Even a share
link is not hosted: the project is compressed into the URL fragment, and
browsers never transmit a fragment. A test in this repository drives the
real application in a real browser and fails if anything leaves the
origin that you did not ask for — the one thing you can ask for is a
#u= link to a schema on another server.
The details are here.
Your dialect
- PostgreSQLpg_dump output, ALTER TABLE keys
- MySQLmysqldump, backticks, inline keys
- SQLite.schema output, typeless columns
- SQL Serverbracketed names, clustered keys
- Snowflakethree-part names, transient tables
Also a command line tool
The same parser, layout engine and renderer build as a native binary with no window at all — useful in a build, a pre-commit hook, or a pull request comment.
$ draft render schema.sql -o schema.svg
$ draft render schema.sql --png -o schema.png
$ draft render schema.sql --json | jq '.relations | length'
And as a desktop application for macOS, Linux and Windows.