SQL to Prisma Schema Converter
Convert PostgreSQL, MySQL, and SQLite CREATE TABLE DDL statements into type-safe Prisma ORM schema models.
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
email String @unique
fullName String? @map("full_name")
age Int?
isActive Boolean? @default(true) @map("is_active")
role String? @default("USER")
metadata Json?
createdAt DateTime? @default(now()) @map("created_at")
updatedAt DateTime? @default(now()) @updatedAt @map("updated_at")
@@map("users")
}
model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean? @default(false)
authorId String @map("author_id")
viewsCount Int? @default(0) @map("views_count")
createdAt DateTime? @default(now()) @map("created_at")
@@map("posts")
}Bridging Relational SQL and Next.js Prisma Workflows
Prisma ORM has become the gold standard for full-stack TypeScript developers building with Next.js, Remix, and Node.js. Translating legacy SQL schemas into Prisma definition files allows teams to unlock autocomplete, end-to-end type safety, and automated database migrations.
Developer Scenarios
- ✓Legacy Database Migration to Prisma ORM
Quickly modernize legacy relational databases by converting production SQL dumps into modern, type-safe Prisma models without running slow introspection commands.
- ✓Supabase & Neon PostgreSQL Schema Sync
Paste SQL migration scripts from Supabase Studio or Neon Serverless Postgres into Prisma schema definitions for full-stack Next.js applications.
- ✓Clean Model Normalization & Mapping
Automatically converts snake_case database columns into idiomatic camelCase JavaScript properties while preserving database fidelity with `@@map` and `@map` directives.
- ✓Microservices Data Contract Rapid Prototyping
Design schema tables in SQL and immediately export compile-time TypeScript types via the generated Prisma Client.
Key Capabilities
Multi-Dialect SQL Compatibility
Supports PostgreSQL, MySQL, SQLite, and CockroachDB syntax including UUID primary keys, serial autoincrement sequences, JSONB, and timestamps.
Automatic Attribute Inferences
Intelligently attaches `@id`, `@default(uuid())`, `@default(autoincrement())`, `@default(now())`, `@updatedAt`, and `@unique` decorators.
Full Datasource & Generator Stubs
Optionally generates the full boilerplate `datasource db` and `generator client` blocks required to initialize new Prisma projects.
One-Click schema.prisma File Export
Download generated schemas directly as `.prisma` configuration files ready to paste into your backend repository.
Frequently Asked Questions
How does SQL to Prisma type mapping work?
SQL types are mapped to Prisma scalar equivalents: `VARCHAR/TEXT` maps to `String`, `INT/SERIAL` maps to `Int`, `BIGINT` maps to `BigInt`, `BOOLEAN` maps to `Boolean`, `TIMESTAMP` maps to `DateTime`, and `JSON/JSONB` maps to `Json`. Nullability is preserved using Prisma's `?` optional operator.
How are snake_case SQL columns handled?
Prisma best practices recommend camelCase for model field names. Our converter automatically transforms names like `created_at` into `createdAt` and attaches `@map("created_at")` so your underlying SQL database schema remains untouched.
Why convert SQL to Prisma schema instead of using prisma db pull?
While `prisma db pull` requires an active live database connection string with open networking ports, this tool operates instantly offline and in your browser. It is ideal for prototyping, migration planning, and transforming DDL files without connecting to production databases.
Does this support multi-table foreign key relations?
Yes! It recognizes `REFERENCES other_table(id)` clauses and sets up corresponding relational foreign key field IDs.
More Developer Tools
Need a Brain Break? ☕
Done working on your task? Take a quick 60-second break, test your reflexes, and flap through infinite pixel obstacles in Sky Flap!