Database ER Diagram Designer

Drag tables on a canvas, edit columns with keys and defaults, link foreign keys, import an existing schema from SQL and export it again for another database.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Start a model

    Keep the sample, press + Table, or paste DDL in Import SQL and choose Replace diagram.

  2. 2
    Arrange tables

    Drag tables by their title bar, zoom, or press Auto layout.

  3. 3
    Edit columns

    Tap a table and set names, types, PK, NN, UQ, AI and defaults.

  4. 4
    Link tables

    Pick a References target and an On delete rule for foreign key columns.

  5. 5
    Export SQL

    In Export choose SQL DDL and the dialect, then copy or download.

  6. 6
    Share the design

    Download DBML, Mermaid, SVG or PNG, and save the project file.

About this tool

An entity relationship diagram shows the tables of a database, their columns and how they reference each other. This designer gives you a canvas of draggable tables with crow's foot lines for each foreign key, and a column grid where you set names, types, primary keys, not null, unique, auto increment, defaults and references with an on-delete rule. You can start from scratch, from the shop sample, or by pasting CREATE TABLE statements from an existing database. When the model is ready, export SQL for PostgreSQL, MySQL or SQLite, a DBML file for dbdiagram-style tools, a Mermaid ER block for documentation, or an image.

Who it is for

Back-end developers planning a schema, students in a databases course, analysts documenting a legacy database, and teams moving between PostgreSQL, MySQL and SQLite.

Importing SQL

Paste DDL from pg_dump --schema-only, SHOW CREATE TABLE in MySQL or .schema in the SQLite shell. The parser understands quoted names, schema-qualified names, inline column constraints, table-level PRIMARY KEY, UNIQUE and FOREIGN KEY constraints, ALTER TABLE … ADD FOREIGN KEY, SERIAL and IDENTITY columns, AUTO_INCREMENT, and comments. Indexes, triggers, views and check constraints are skipped.

Designing

Drag a table by its dark title bar. Tap a table to edit it below the canvas: rename it (references follow), add columns, tick PK, NN, UQ or AI, pick a type from the list or type your own, and choose what the column references. Only primary key and unique columns are offered as targets, because a foreign key must point at a unique column. Auto layout arranges tables in columns with the least dependent first.

Exporting for each database

The SQL export orders tables so that referenced tables are created first, writes composite primary keys as table constraints and translates types and auto increment: - PostgreSQL: serial or bigserial, timestamp instead of datetime, bytea for blobs. - MySQL: INT AUTO_INCREMENT, CHAR(36) for uuid, JSON for jsonb, InnoDB with utf8mb4. - SQLite: the type affinities INTEGER, TEXT, REAL, NUMERIC and BLOB, with INTEGER PRIMARY KEY AUTOINCREMENT.

Worked example

The sample has customers, products, orders and order_items. order_items has a composite key (order_id, product_id) and two foreign keys. Exported for MySQL, customers.id becomes id INT PRIMARY KEY AUTO_INCREMENT, and order_items ends with PRIMARY KEY (order_id, product_id), FOREIGN KEY (order_id) REFERENCES orders (id) ON DELETE CASCADE and FOREIGN KEY (product_id) REFERENCES products (id).

Limits

This is a design tool, not a migration tool: it does not connect to a live database or produce ALTER scripts for changes. Multi-column foreign keys are reduced to their first column, and database-specific features such as enums, partitions or generated columns are not modelled. Always review generated SQL before running it on real data.

Worked example

Shop sample exported for MySQL: 4 tables, composite key on order_items, 3 foreign keys with ON DELETE CASCADE.

Quick facts

Frequently asked questions

Can I import my existing database?

Yes, paste its CREATE TABLE statements (schema only) into Import SQL.

Which databases can I export for?

PostgreSQL, MySQL or MariaDB and SQLite, plus DBML and Mermaid ER.

Does it change my database?

No. It never connects to a database; it only produces text you can review and run yourself.

How do I add a foreign key?

Edit the table, and in the column's References menu choose the target table and key column.

Can I export a picture of the diagram?

Yes, as SVG or as a PNG at double resolution.

What does auto increment become in each database?

serial in PostgreSQL, AUTO_INCREMENT in MySQL and INTEGER PRIMARY KEY AUTOINCREMENT in SQLite.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages