🔄 SQL to Prisma Schema Generator

Free online tool to convert SQL CREATE TABLE statements into Prisma model definitions. Supports MySQL/PostgreSQL/SQLite dialects with auto foreign key detection.

Zero Dependencies · Works Offline

📝 Input SQL

⚙️ Conversion Options

📦 Prisma Schema Output

// Paste SQL CREATE TABLE statements on the left to auto-generate Prisma Schema

What Can SQL to Prisma Schema Do?

The SQL to Prisma Schema Generator is an online tool for Node.js/TypeScript developers that automatically converts SQL CREATE TABLE statements into Prisma Schema model definitions. When migrating from traditional SQL databases to Prisma ORM, this tool saves you from manually writing schema.prisma files by generating Prisma-compliant model code with one click.

Core Features

How to Use

1. Paste your SQL CREATE TABLE statements into the input box, or click "Load Example" for a demo; 2. Select database dialect (MySQL/PostgreSQL/SQLite) and naming style; 3. The tool auto-generates Prisma Schema code in real-time; 4. Click "Copy" to copy the schema to clipboard, or download as .prisma file; 5. Place the code in your project's schema.prisma file and run npx prisma generate.

Use Cases

Database Migration

When migrating from traditional SQL projects to Prisma ORM, batch convert existing CREATE TABLE statements to Prisma Schema for a quick ORM switch.

New Project Setup

After DBA designs the database schema, frontend developers use this tool to quickly generate Prisma models and start TypeScript full-stack development.

Documentation Reverse Engineering

Reverse-engineer Prisma Schema from legacy database DDL scripts, bringing modern ORM solutions to old projects.

Extended Knowledge

Prisma is a next-generation TypeScript ORM with a declarative schema.prisma file at its core. Unlike traditional ORMs like TypeORM/Sequelize that use classes and decorators, Prisma defines models through Schema and auto-generates type-safe clients. Prisma supports auto-migration (prisma migrate dev), data browser (prisma studio), and a powerful query API. SQL-to-Prisma type mapping follows official conventions: INT→Int, BIGINT→BigInt, VARCHAR→String, BOOLEAN→Boolean, DATETIME→DateTime, DECIMAL→Decimal, etc.

âť“ FAQ

What is Prisma?

Prisma is a next-generation TypeScript/Node.js ORM tool that uses a declarative schema.prisma file to define data models and auto-generates type-safe database clients.

Which SQL dialects are supported?

MySQL, PostgreSQL, and SQLite. Dialect-specific types are automatically mapped to corresponding Prisma types.

Are foreign key relationships supported?

Yes. The tool auto-detects FOREIGN KEY constraints and generates corresponding Prisma relation fields with @relation attributes.

Can the generated Prisma Schema be used directly?

Yes. The generated code follows Prisma official conventions with model definitions, field types, and attribute annotations.

How are ENUM types handled?

SQL ENUM types are automatically converted to Prisma enum definitions, placed before model declarations with values fully preserved.

Is my data safe?

Completely safe. This tool runs 100% in the browser. Your SQL statements are processed only in local memory, never uploaded to any server.

SQL to Prisma Schema | No Signup, Client-Side · No Server Uploads

Feedback: dexshuang@google.com

Copied!