Skip to content

Drizzle ↔ Prisma Schema Converter

Convert Drizzle ORM schemas to Prisma and back, with parity reports for tables, columns, relations, and indexes.

Drizzle ↔ Prisma Schema Converter

Drizzle source
Converted output
// Generated by AI Dev Hub — Drizzle → Prisma
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id               Int  @id @default(autoincrement())
  email            String  @unique
  name             String
  createdAt        DateTime  @default(now()) @map("created_at")
  posts            Post[]
}

model Post {
  id               Int  @id @default(autoincrement())
  authorId         Int  @map("author_id")
  author           User @relation(fields: [authorId], references: [id], onDelete: Cascade)
  title            String
  body             String?
  createdAt        DateTime  @default(now()) @map("created_at")
  @@unique([authorId, title], name: "posts_author_idx")
}

2 tables, 9 columns converted

Tables
2
Columns
9
Relations
2
Indexes
1

Updated . Provided as is. Check the output before you rely on it in production.

How to use Drizzle ↔ Prisma Schema Converter

  1. 1

    Choose a direction

    Pick Drizzle → Prisma to feed in pgTable definitions, or Prisma → Drizzle to feed in model blocks. The active direction controls which input pane is read.

  2. 2

    Paste your source schema

    The parser reads pgTable() exports for Drizzle and model { } blocks for Prisma. Comments are ignored and identifiers are preserved.

  3. 3

    Review parity counters

    Check the Tables, Columns, Relations, and Indexes counters under the editor. Mismatches there usually mean the source uses constructs the parser does not recognize yet.

  4. 4

    Read the manual-review notes

    Items like enums, custom types, and database-specific extensions surface in the amber review panel. Apply them by hand before running migrations.

Questions and answers

What is Drizzle Prisma Schema Converter?
Drizzle and Prisma are TypeScript ORMs that define tables in different syntax: Drizzle as pgTable() calls, Prisma as model blocks in schema.prisma. This converter translates PostgreSQL schemas either way, carrying columns, keys, defaults, relations and indexes, and reports parity counts plus items to review by hand.
Which features convert cleanly?
Tables, scalar columns, primary keys, unique constraints, default values, simple foreign keys with onDelete, single-column and composite indexes round-trip without manual edits in most projects.
Which features need manual review?
Enums, custom database types, JSONB shapes, Postgres extensions, computed columns, and partial indexes are flagged in the amber review panel because their syntax has no direct equivalent on the other side.
Does it run my schema on a database?
No. The converter is purely textual. It does not connect to Postgres, MySQL, or any database; it simply parses your input and emits the equivalent ORM source code.
Does it send my data to a server?
No. Parsing and emission happen in your browser. The schema text never leaves the tab, and there are no telemetry or analytics calls in the conversion path.
For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/drizzle-prisma-schema-converter/

For automation planning, fetch the canonical contract at /api/tool/drizzle-prisma-schema-converter.json.