SQL to ER Diagram
Home › Prisma to DBML

Prisma to DBML

Paste your schema.prisma and export it as DBML — ready for dbdiagram.io and other DBML tools — while you preview the live ER diagram.

Open the diagram tool →
No signup · nothing uploaded · export PNG / SVG / Mermaid / DBML · shareable link
ER diagram of the Prisma to DBML example schema: User and Post (2 tables, 1 relationship)
The Prisma to DBML example below, drawn by the tool: User and Post (2 tables, 1 relationship).

At a glance

What it is
SQL to ER Diagram is a free, open-source browser tool that turns a Prisma schema into DBML.
Input
A Prisma schema: the contents of schema.prisma.
Output
DBML code to copy, alongside a live interactive diagram.
Cost
Free. MIT-licensed open source. No account or signup.
Privacy
Runs entirely in your browser. The schema is never uploaded, and share links carry the diagram in the URL fragment, which is not sent to a server.
Limits
It never connects to your database itself: you paste schema text, or run one read-only catalog query in your own client and paste the result. There are no accounts, so there is no real-time multi-user editing; diagrams are kept in your browser, as a saved file, or as a share link. Layout stays smooth at around 300 tables.

How it works

  1. Paste the contents of your schema.prisma — Prisma is auto-detected.
  2. The diagram renders so you can confirm models and relations.
  3. Click Export → DBML and copy the result.
  4. Paste it into dbdiagram.io or any DBML-based workflow.

Example

This Prisma schema:

model User {
  id    Int    @id @default(autoincrement())
  email String @unique
  posts Post[]
}
model Post {
  id       Int  @id @default(autoincrement())
  author   User @relation(fields: [authorId], references: [id])
  authorId Int
}

…exports as this DBML:

Table "User" {
  "id" Int [pk]
  "email" String [unique]
}
Table "Post" {
  "id" Int [pk]
  "authorId" Int
}
Ref: "Post"."authorId" > "User"."id"

Copy it from Export → DBML. Try it with your own →

Guide

The conversion follows DBML's semantics: a Prisma model becomes a Table, @id becomes [pk], @default(autoincrement()) becomes [increment], @unique becomes [unique], and each @relation(fields: [authorId], references: [id]) becomes a standalone Ref: "Post"."authorId" > "User"."id" line. Scalar lists (String[]) and enums carry over as column types.

Why you'd want this: DBML is the interchange format for dbdiagram.io, dbdocs.io and the @softwaretechnik/dbml-renderer CLI. Converting your schema.prisma to DBML lets you paste the schema into dbdiagram for pretty static renders, publish dbdocs documentation, or diff schemas textually. The conversion runs entirely in your browser — the schema never touches a server, which matters when the schema contains real customer table names.

Check the live diagram before you copy the export: if a relation is missing on the canvas, the @relation was probably implicit on both sides, and the DBML will contain a many-to-many edge rather than a hidden join table — which is usually the honest representation.

Why use it

Prisma → DBMLPrisma → MermaidPrisma → SVG

FAQ

How do I convert a Prisma schema to DBML?

Paste your schema.prisma, then click Export → DBML and copy the output. Models become Tables and @relation fields become Refs.

Is my schema uploaded anywhere?

No. Everything runs locally in your browser — your schema is never uploaded to or stored on any server.

Is it free?

Yes. It is completely free and open source, with no account or sign-up required.

Related