SQL → Prisma Schema
Paste your SQL CREATE TABLE
statements and instantly generate clean
Prisma schema models.
Perfect for migrating existing databases to Prisma ORM.
model User {
id Int @id @default(autoincrement())
email String
name String?
bio String?
age Int?
isActive Boolean @default(true) @map("is_active")
role String @default("user")
avatarUrl String? @map("avatar_url")
loginCount Int @default(0) @map("login_count")
lastLogin DateTime? @map("last_login")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
@@map("users")
}
model Post {
id BigInt @id @default(autoincrement())
title String
slug String @unique
content String?
published Boolean @default(false)
viewCount Int @default(0) @map("view_count")
authorId Int @map("author_id")
categoryId Int? @map("category_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
@@map("posts")
}
model Category {
id Int @id @default(autoincrement())
name String @unique
description String?
parentId Int? @map("parent_id")
sortOrder Int @default(0) @map("sort_order")
createdAt DateTime @default(now()) @map("created_at")
@@map("categories")
}Why Convert SQL to Prisma Schema?
Migrate Existing Databases to Prisma
If you have existing SQL tables and want to adopt Prisma ORM, manually rewriting every table definition as a Prisma model is tedious and error-prone. This converter automates the process, mapping SQL types to Prisma types, handling nullable fields, defaults, primary keys, and unique constraints automatically.
Type-Safe Database Access
Prisma generates a fully type-safe client from your schema. By converting SQL DDL to Prisma models, you instantly get autocomplete, compile-time checks, and runtime validation for every database query — eliminating common bugs caused by schema mismatches between SQL and application code.
Common Use Cases
- Migrate legacy MySQL databases to Prisma ORM
- Convert PostgreSQL schemas for new TypeScript projects
- Bootstrap Prisma schema from existing SQL dumps
- Generate type-safe models from database documentation
- Convert SQLite schemas for edge/serverless deployments
- Create Prisma models from database migration files
- Port Django/Rails SQL to Node.js with Prisma
- Convert stored procedure table definitions to models
- Generate Prisma schema from database reverse-engineering
How It Works
This tool parses your SQL entirely in the browser and converts each CREATE TABLE statement into a Prisma model:
VARCHAR / TEXT→StringINT / INTEGER→IntBIGINT / BIGSERIAL→BigIntBOOLEAN→BooleanTIMESTAMP / DATETIME→DateTimeJSON / JSONB→JsonPRIMARY KEY→@idAUTO_INCREMENT / SERIAL→@default(autoincrement())DEFAULT CURRENT_TIMESTAMP→@default(now())NOT NULL omitted→Type?(optional)
All processing happens locally in your browser — no SQL is uploaded to any server, ensuring your database schemas remain completely private.
Explore More Developer Tools
Boost your productivity with our other privacy-first utilities.
AI Mock Generator
Generate realistic mock data from natural language prompts. Runs entirely in your browser — no API keys required, no data leaves your machine.
JWT Debugger
Decode, inspect, and validate JWT token headers and payloads without sending credentials to any server. Fully offline, privacy-first debugging.
Aurora Gradient Generator
Create animated, pure CSS aurora backgrounds and mesh gradients. Generate Tailwind classes or raw CSS instantly. 100% local, privacy-first execution.