Command Palette
Search for a command to run...
SQL to Prisma Schema Converter
Translate raw SQL CREATE TABLE statements into clean, typed Prisma ORM models with automatic relation and constraint mapping.
model User {
id Int@id@default(autoincrement())
email String?
}
model Profile {
id Int@id@default(autoincrement())
bio String?
age Int?
}How It Works
Simple, fast, and 100% secure in 3 steps.
Input SQL Schema
Paste your raw SQL CREATE TABLE statements, including foreign keys, indexes, and constraints.
Configure Mapping
Select your database provider and toggle automatic snake_case to camelCase field mapping with @map() directives.
Generate Prisma Models
Instantly receive a fully formatted schema.prisma file with relations, defaults, and type mappings ready for prisma generate.
Key Features & Capabilities
Designed for accuracy, privacy, and maximum efficiency.
Multi-Provider Support
Generates syntax compatible with PostgreSQL, MySQL, SQLite, and SQL Server database providers.
Automatic Relation Mapping
Detects FOREIGN KEY constraints and translates them into Prisma @relation directives with proper field references.
Smart Case Conversion
Automatically converts snake_case SQL columns to camelCase Prisma fields while preserving the original name via @map().
Default & Constraint Parsing
Accurately maps PRIMARY KEY, UNIQUE, NOT NULL, and DEFAULT values (including CURRENT_TIMESTAMP) to Prisma attributes.
Migrating from SQL to Prisma ORM
Transitioning an existing relational database schema to Prisma ORM can be a daunting task, especially when dealing with legacy databases containing dozens of tables, complex foreign key constraints, and custom default values. While Prisma offers a db pull command to introspect an active database, developers often need to convert raw SQL dump files or CREATE TABLE scripts into Prisma schema language (PSL) before a database is even provisioned. Our SQL to Prisma Schema Converter bridges this gap by parsing raw SQL syntax and outputting clean, formatted Prisma models entirely in your browser.
The parser is designed to handle the nuances of SQL schema definitions, including data type mapping. It translates VARCHAR and TEXT to Prisma String, INT and SERIAL to Int, and properly flags TIMESTAMP fields as DateTime. Crucially, it identifies PRIMARY KEY constraints and applies the @id attribute, while detecting AUTO_INCREMENT or SERIAL types to append @default(autoincrement()). Foreign key references are intelligently mapped to Prisma's @relation directives, ensuring your data graph remains intact and queryable via the Prisma Client.
Furthermore, the tool respects modern naming conventions by offering automatic conversion from SQL's traditional snake_case to TypeScript-friendly camelCase. When enabled, the converter renames fields like user_profile_id to userProfileId while safely appending an @map("user_profile_id") attribute so Prisma knows exactly which column to query in the underlying database. This eliminates hours of manual schema transcription and prevents costly typos during migration projects.
Frequently Asked Questions
Everything you need to know about using this tool.