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.
Related tools
All Developer Utilities toolsNext step
Need this built into your stack?
The team behind SyntaxSnap builds custom code generators, internal developer tools and API integrations.