SQL to Prisma Converter
Free online SQL to Prisma Converter. 100% client-side.
Loading tool...
What is SQL to Prisma Converter?
SQL to Prisma Converter is a browser-based developer tool that translates common SQL CREATE TABLE definitions into Prisma schema models. It infers practical Prisma scalar types, keys, defaults, constraints, and simple relations without uploading your database definition.
Key Benefits
- Save time when starting a Prisma project from an existing SQL schema.
- Keep schema text private with fully client-side conversion.
- Get a readable schema.prisma starting point for manual refinement.
Common Use Cases
- β’Bootstrap Prisma models from legacy MySQL or PostgreSQL DDL.
- β’Prototype a schema before connecting Prisma to a database.
- β’Explain SQL table structures to teams using Prisma ORM.
How to Use the SQL to Prisma Converter
- Paste SQL DDL: Paste one or more CREATE TABLE statements into the SQL DDL input. Include columns, primary keys, and foreign keys when available.
- Choose the Provider: Select PostgreSQL, MySQL, SQLite, or SQL Server to set the provider in the generated datasource block.
- Convert the Schema: Click Convert to Prisma. The tool maps SQL types and constraints, creates model blocks, and detects simple foreign-key relations.
- Review and Export: Review the generated schema, copy it to your project, or download it as schema.prisma. Treat the result as a starting point and validate it with Prisma.
Key Features
- Convert common CREATE TABLE DDL statements into editable Prisma models
- Map integer, decimal, float, boolean, date, JSON, binary, and text SQL types
- Recognize inline and table-level primary keys, unique fields, and composite constraints
- Translate common defaults including autoincrement, now, UUID, and literal values
- Detect simple foreign keys and generate Prisma relation fields with fields and references
- Choose PostgreSQL, MySQL, SQLite, or SQL Server and download schema.prisma
Frequently Asked Questions
What SQL syntax does the converter support?
It focuses on common CREATE TABLE DDL, including column definitions, inline or table-level primary keys, unique constraints, defaults, and simple FOREIGN KEY ... REFERENCES clauses.
Which SQL types are mapped to Prisma types?
Common integer, decimal, floating-point, boolean, date/time, JSON, binary, and text types are mapped to practical Prisma scalar types. Unrecognized types fall back to String for manual review.
Does it send my SQL to a server?
No. Conversion runs entirely in your browser. Your SQL and generated schema are not uploaded or sent to an API.
Is the generated schema ready for production?
The output is a useful starting point, not a database introspection replacement. Review provider-specific types, naming, relation cardinality, and defaults, then run Prisma validation and migration checks.