ER diagram tool

Draw an entity relationship diagram: each table with its columns, primary and foreign keys and types, and the relationships between them in crow's foot notation. It opens with a small shop's tables to change into your own.

Type the columns

Double-click a table to edit it as text: its name on the first line, then one column per line, as name, type and keys, such as "id uuid PK" or "user_id uuid FK NN". Enter adds a line and Ctrl+Enter finishes; the table grows to fit.

  • PK: primary key
  • FK: foreign key
  • UK: unique
  • NN: not null

The shape library also has a view, drawn dashed, and an enum, whose lines are its values.

Crow's foot notation

Each end of a relationship says how many rows can be at that end: the mark next to the table is the most, the one further out the fewest.

  • ||: exactly one
  • o|: zero or one
  • |< (a bar and a crow's foot): one or many
  • o< (a circle and a crow's foot): zero or many

A connector drawn from one table to another starts as one to zero or many; change either end under Start and End in the format panel.

Keys meet their rows

Every column has a connection point on both sides of its table, so a foreign key's connector can join the very row it is on, and stays on it as columns are added or removed below.

From SQL or Mermaid

Turn an existing schema into a diagram: choose "From Mermaid or SQL…" in the menu beside New Diagram and paste CREATE TABLE statements, from a migration or a dump such as pg_dump --schema-only. Each table comes in with its columns, types and keys, every foreign key becomes a relationship between the rows it joins, and the tables are laid out with each one to the left of the tables that refer to it.

It reads PostgreSQL, MySQL, SQL Server, SQLite and Oracle: quoted and bracketed names, schemas, inline REFERENCES, table constraints and ALTER TABLE … ADD FOREIGN KEY. A nullable foreign key starts its relationship at zero or one; a unique one ends it at zero or one instead of many. Mermaid's erDiagram works too.

Questions

Can it import my database schema?

Yes, from SQL: paste the CREATE TABLE statements (most database tools can copy or export them) under "From Mermaid or SQL…" beside New Diagram. Nothing is sent to a server, so the schema stays on your computer.

Which databases does it work for?

Any: the types are whatever you type, so PostgreSQL, MySQL, SQL Server, SQLite and others all work the same.

Can I export it?

Yes: as PNG or SVG for documentation, or as a .diag file to open and edit again later.

More tools