SQL to Prisma Schema Converter

Convert SQL CREATE TABLE DDL statements into production-ready Prisma ORM schema models instantly in your browser.

At a glance

SQL to Prisma Schema Converter is a free developer tool that converts SQL CREATE TABLE DDL statements into clean Prisma ORM schema models. It automatically maps SQL column types, primary keys, auto-increment sequences, default values, and nullable fields into Prisma model syntax without requiring a live database connection.

Universal Switcher:
From:
To:

100% Client-Side SQL to Prisma Converter

Zero Server Uploads

Convert SQL CREATE TABLE DDL statements into production-ready Prisma schema models directly in your browser with zero remote database connections.

Local Sandbox
Presets:
0 lines • 0 chars
0 models • 0 fields

Why Use This SQL to Prisma Schema Converter?

100% Client-Side Privacy: Database schemas, table structures, and internal column identifiers never leave your local machine.
Comprehensive Type Mapping: Translates PostgreSQL, MySQL, SQLite, and ANSI SQL types into standard Prisma scalar types.
Constraint & Attribute Detection: Automatically extracts primary keys, foreign keys, uniques, autoincrement sequences, and default timestamps.
Configurable Naming Conventions: Automatically converts table names to PascalCase with @@map attributes to match Prisma ORM conventions.
Multi-Dialect Compatibility: Supports PostgreSQL, MySQL, SQLite, and Microsoft SQL Server datasource providers with client generator configuration.

How to Use SQL to Prisma Schema Converter

1

Paste SQL DDL

Enter or paste your SQL CREATE TABLE statements into the left editor or choose a preset.

2

Configure Options

Select your database provider (PostgreSQL, MySQL, SQLite) and toggle PascalCase or camelCase mappings.

3

Copy or Download Schema

Copy generated Prisma models to your clipboard or download as a ready-to-use schema.prisma file.

Converting SQL CREATE TABLE to Prisma Schema

Demonstrates converting a PostgreSQL users table into an idiomatic Prisma model with primary key, unique constraints, nullable attributes, default timestamps, and table mapping.

SQL DDL Input Source
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email VARCHAR(255) NOT NULL UNIQUE,
  full_name VARCHAR(100),
  is_active BOOLEAN DEFAULT TRUE NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
);
Generated schema.prisma Output Processed
model User {
  id        Int      @id @default(autoincrement())
  email     String   @unique
  full_name String?
  is_active Boolean  @default(true)
  created_at DateTime @default(now())

  @@map("users")
}

Technical Specifications & Engine Details

Technical specifications and engine details for SQL to Prisma Schema Converter
Specification Details
Supported Formats SQL, DDL, TEXT → PRISMA, SCHEMA, TEXT
Execution Mode 100% Client-Side In-Browser (client)
Browser Requirements Modern browser with JavaScript enabled.
Performance Constraints 100% Client-Side. Runs locally in browser JavaScript memory.
Maintained by Pragyan Pahadi

100% Client-Side Privacy Guarantee

All SQL DDL parsing and Prisma schema generation execute client-side in browser memory. Zero database definitions leave your device.

Frequently Asked Questions

Does this tool require a connection to my database?
No. The converter parses raw SQL CREATE TABLE DDL text entirely client-side in your browser. You do not need to provide database credentials or connect to any live server.
Which SQL dialects are supported?
It supports standard ANSI SQL, PostgreSQL, MySQL, and SQLite DDL syntax, including backtick identifiers, double-quoted schema qualifiers, SERIAL/AUTO_INCREMENT types, and default timestamps.
How are table names formatted in the generated Prisma schema?
By default, table names like "user_profiles" or "users" are converted to idiomatic PascalCase model names ("UserProfile") and annotated with @@map("user_profiles") so database table names remain unchanged.
Are composite primary keys supported?
Yes. When a table declares a composite primary key like PRIMARY KEY (user_id, role_id), the converter generates model-level @@id([user_id, role_id]) attributes.

Methodology

This tool runs entirely in your browser. The example above shows a representative input and the result it produces.

Last updated .