elefcode

DB Designer

Loading the diagram…

4 tables · 17 columns · 3 relations. Click a table to edit it. Drag from a column's dot to another column to link them, or from a primary key onto a table to add a foreign key.

Problems

✓ No problems found.

Tables

Enums

A column whose type is an enum's name can only hold its values.

Advertisement

Guide

About the DB Designer

Sketch a database the way you think about it — boxes and lines — and get the code that creates it. Every change updates the SQL, Prisma, DBML and Mermaid output at once, and the checks point out what the database would reject before you run anything.

Already have a schema? Paste the CREATE TABLE statements or a Prisma schema and it is drawn for you, laid out by its relationships. SQL runs in a real PostgreSQL (PGlite) or SQLite engine in your browser, so types, defaults, keys and indexes come out exactly as the database reads them. Nothing is uploaded.

Moving between databases and ORMs

Types are translated for each target: uuid becomes CHAR(36) in MySQL and TEXT in SQLite, jsonb becomes JSON, identity columns become AUTO_INCREMENT or AUTOINCREMENT, and enums become CREATE TYPE, ENUM(…) or a CHECK constraint. The Prisma export maps snake_case tables and columns to Prisma model and field names with @map and @@map, names the relation fields, and turns Prisma's own join tables back into implicit many-to-many lists.

Try it out

From the PostgreSQL or SQLite output, one click opens the schema in the SQL Playground, ready to run and query. The Mermaid output opens in Mermaid Diagram, where you can export the diagram as PNG or SVG for documentation.

How to use it

  1. 1Add tables with + Table, or pick a template, or import SQL or a Prisma schema.
  2. 2Click a table to edit its columns, keys, indexes and notes in the side panel.
  3. 3Drag from a column’s dot to another column to add a foreign key — or from a primary key onto a table to create the column for you.
  4. 4Open the Code tab and choose PostgreSQL, MySQL, SQLite, Prisma, DBML or Mermaid. Copy or download it.

Frequently asked questions

Which databases can it import?

PostgreSQL and SQLite scripts run in real engines in your browser. MySQL scripts, including mysqldump and Workbench exports, are converted first so the SQLite engine can read them; enums, AUTO_INCREMENT, comments and indexes are kept. Prisma schemas are read directly.

Does it keep my data from a dump file?

No — only the schema. INSERT statements and COPY blocks are skipped, which also keeps large dumps fast.

Is the Prisma output ready for Prisma 7?

Yes. It uses the prisma-client generator with an output path and leaves the connection URL to prisma.config.ts. Native types such as @db.VarChar(255) and @db.Uuid are added for the database you choose.

Can I export the diagram as an image?

Choose the Mermaid output and open it in Mermaid Diagram, which exports PNG and SVG. The Mermaid text also renders directly on GitHub and GitLab.

Where is my design stored?

In your browser’s local storage, so it is there when you come back. Use Save to keep a file, or the Share button for a link with the design in it. Nothing is sent to a server.

Related tools