Skip to content
flowchart.tools

ER diagrams for database design

A schema is easier to review as a picture than as a migration file. Draw a new database before you write the DDL, or paste the DDL you already have and see what it actually says.

For: Backend developers, data engineers and database administrators

The problem

Schema mistakes are the most expensive kind to fix after launch: a missing junction table, a nullable foreign key that should not be, a one-to-one that turns out to be one-to-many. They are much easier to spot when the relationships are drawn, but reverse-engineering tools usually want a live database connection, which is the last thing you want to hand to a website.

Which diagrams fit

ER diagram
Crow's foot tables with columns, keys and relationship cardinality: the standard notation for relational design.
UML
Class diagrams when you are designing the application's domain model and the tables follow from it.

A way of working

  1. For an existing database, export the schema as DDL (pg_dump --schema-only, mysqldump --no-data, or your migration files) and paste it into SQL to ER diagram. Nothing is uploaded.

  2. Check every relationship line in both directions against the real rules: can an order exist without a customer? Can a customer have two profiles?

  3. Open the diagram in the editor and correct line ends where the converter's default (zero or many to exactly one) does not match a nullable or unique key.

  4. For a new design, start from the e-commerce ER template or a blank ER canvas, model the entities and relationships first, then write the DDL from the finished diagram.

What the SQL converter reads

SQL to ER diagram reads CREATE TABLE statements from PostgreSQL, MySQL, SQLite and SQL Server dialects: columns and types, primary keys, and foreign keys declared inline or as table constraints. Every foreign key becomes a relationship line. It does not connect to a database and does not need one, which is what makes it safe for production schemas.

Review the cardinality, not just the boxes

The value of an ER diagram is in its line ends. A converter can see that orders.customer_id references customers, but whether that key may be null, or should be unique, is a decision the diagram should make visible. Read each relationship aloud in both directions. Most schema bugs show up as a sentence that is false in one of them.

Hand it off

Export SVG or PNG for a design review, or a draw.io file if a colleague needs to annotate it in another tool. The editor's own JSON file reopens the diagram exactly as you left it. For a schema that should live in a repository as text, Mermaid's erDiagram syntax renders in the Mermaid editor, and the crow's foot guide shows how its symbols map to the ones on the canvas.

Templates to start from

Tools for this job

Read next

Questions

Does the tool connect to my database?
No, and it never asks to. You paste schema DDL and it is parsed in your browser. That is deliberate: a diagram tool should not need credentials to your database.
Which SQL dialects are supported?
CREATE TABLE syntax from PostgreSQL, MySQL and MariaDB, SQLite and SQL Server, including inline REFERENCES and FOREIGN KEY table constraints. Statements it does not understand, such as indexes and triggers, are skipped rather than breaking the diagram.
Can it generate SQL from a diagram?
No. The editor draws and exports diagrams; it does not generate DDL or migrations. Design in the diagram, then write the migration in your usual tool.

Other use cases