SQL to ER diagram.Straight from your schema.

Paste CREATE TABLE statements from MySQL, PostgreSQL or SQLite. Tables, keys and relationships are read from the SQL and laid out as an entity relationship diagram you can rearrange and download.

Primary key Foreign key

What the diagram reads from your SQL.

The diagram is built from the same statements your database runs. Nothing is inferred from column names, so what you see is what the schema declares.

PRIMARY KEY, AUTO_INCREMENT, SERIAL
An amber key marks the primary key column.
REFERENCES, FOREIGN KEY
A blue key marks the column, and a line connects it to the table it references.
ALTER TABLE … ADD CONSTRAINT
Keys added later with ALTER TABLE are picked up too, which is how pg_dump writes them.
VARCHAR(255), NUMERIC(10, 2)
Each column shows its type, including length and precision.

Frequently asked questions

Keep the diagram as current as the schema.

A pasted diagram is out of date after the next migration. UIGraph syncs database schemas from your repo and keeps them next to the services that own them.