Prisma to Drizzle Converter

Paste a Prisma schema and get a complete Drizzle ORM TypeScript schema file back in one click. The converter maps Prisma scalars to the correct Drizzle column helpers (serial, text, integer, boolean, timestamp, jsonb…), emits the right import line, wires .primaryKey(), .notNull(), .unique(), .defaultNow(), and generates index helpers from @@index blocks.

How to use the Prisma to Drizzle Converter

Paste your schema.prisma content into the input area. Choose PostgreSQL (uses drizzle-orm/pg-core) or MySQL (uses drizzle-orm/mysql-core) from the dialect selector, then click Convert to Drizzle.

The output is a self-contained TypeScript module you can drop into your project. For each Prisma model block the converter emits an export const tableName = pgTable('db_table', { ... }) declaration. Fields with @id @default(autoincrement()) become serial('id').primaryKey() on Postgres or int({ autoIncrement: true }).primaryKey() on MySQL. Optional fields (?) drop the .notNull() chain. @unique adds .unique(). @default(now()) adds .defaultNow().

Relation list fields (Post[]) are skipped as they are not real columns. FK relationships are noted as comments so you can add Drizzle relations() helpers manually. @@index block attributes generate the (table) => ({ idx: index(...).on(...) }) callback form. The import line at the top of the output automatically includes every function used.

What is Drizzle ORM?

Drizzle ORM is a lightweight, TypeScript-first database toolkit for Node.js, Deno, and Bun. Unlike heavier ORMs, Drizzle uses a schema-as-code approach where you define your tables in TypeScript and Drizzle infers all types from those definitions — there is no separate code-generation step at runtime. The schema file is also used to generate type-safe query builders, so your queries get full autocomplete and compile-time safety.

Prisma is the most popular ORM in the TypeScript ecosystem but many teams are moving to Drizzle for its lighter footprint, edge-runtime compatibility, and its SQL-like query builder that makes raw query power accessible without losing type safety. When migrating from Prisma to Drizzle the most time-consuming step is rewriting the schema — every model block becomes a pgTable or mysqlTable call with different column helper functions. This converter automates that translation.

The converter covers the common cases: scalar types, primary keys, auto-increment serials, nullable columns, unique constraints, default values, and indexes. Drizzle relations() — which describe the application-level join graph — are left for you to define, since they require naming decisions the converter cannot make. The output is valid TypeScript ready to paste into a schema.ts file and extend.

Common use cases

  • Prisma → Drizzle migration — convert the entire Prisma schema to a Drizzle schema file as the first step in migrating your stack.
  • Scaffolding new tables — write the model in Prisma-style syntax (which is concise and readable), then convert to get the verbose Drizzle boilerplate.
  • Code reviews — share the Drizzle schema with team members already familiar with it, generated from the Prisma source of truth.
  • Learning Drizzle — use the converter to see how Prisma types and attributes map to Drizzle column helpers and method chains.
  • Multi-dialect support — generate Postgres and MySQL variants from the same Prisma schema when running the same application against different databases.

Frequently asked questions

Do I need to install anything?

No — the converter runs entirely in your browser. Install drizzle-orm and the appropriate driver in your project when you are ready to use the generated schema.

What happens to @relation fields?

Relation list fields (e.g. posts Post[]) are omitted from the output — they have no SQL column backing. FK scalar fields (e.g. authorId Int) are emitted as regular integer columns. Drizzle relations() helpers are noted as comments for you to wire manually.

Does it generate the Drizzle relations() helper?

Not automatically — relations() in Drizzle is an application-layer concept that requires naming the relationship from both sides, which the converter cannot infer reliably. The output includes comments pointing you to the right column to reference.

How are enums handled?

Prisma enum types are mapped to varchar({ length: 255 }) on both dialects. If you want a native Postgres enum, Drizzle supports pgEnum — add that manually after converting.

Why is @@map important?

Prisma model names are PascalCase (e.g. User) but the actual database table might be snake_case (users). @@map("users") tells Prisma (and this converter) to use the real table name in the generated SQL and Drizzle table definition.