SQL to Prisma
FreeConvert SQL CREATE TABLE statements to Prisma schema
model Users {
id Int @id
name String
email String?
}About SQL to Prisma
Adopting Prisma on an existing database means turning your SQL schema into a Prisma schema, and hand-writing models for every table, column type, and relation is slow and easy to get subtly wrong. This tool reads your SQL CREATE TABLE statements and generates the corresponding Prisma model definitions, giving you a head start on your schema.prisma file.
Paste your CREATE TABLE SQL and the converter maps tables to models, columns to fields with Prisma types, and primary keys and constraints to the matching attributes. It is free, runs in your browser, needs no signup, and returns the schema instantly. Treat the output as a strong starting point: review the generated types, relations, and attributes against your real database before relying on it.
Common uses
- Bootstrapping a schema.prisma file from an existing SQL database
- Migrating a legacy SQL schema into a Prisma-based project
- Converting CREATE TABLE statements into Prisma models quickly
- Getting a draft Prisma schema to refine instead of writing from scratch
- Translating column types and keys from SQL into Prisma syntax
How to use
- 1
Configure options
Set your preferences using the options panel below.
- 2
Click Generate
Click the process button to generate your result instantly.
- 3
Copy or download
Copy the result to clipboard or download it directly to your device.
Why ToolHub?
- Accurate conversion
- Multiple formats
- Instant results
FAQ
Does it infer relations between tables?
Foreign keys can map to Prisma relations, but you should verify the relation fields and references, since cross-table inference is imperfect.
Are all SQL column types supported?
Common types map to Prisma equivalents. Vendor-specific or unusual types may need manual adjustment after conversion.
Should I use the output as-is?
Treat it as a starting draft. Review types, optionality, defaults, and relations against your database before running migrations.
Which SQL dialect does it expect?
Standard CREATE TABLE syntax works best. Dialect-specific extensions may not translate cleanly and could need tweaking.
Can I use SQL to Prisma on mobile?
Yes — ToolHub is fully responsive and works on iPhone, Android, tablets and all modern browsers. No app install needed.