SQL CREATE TABLE to Prisma schema
Convert SQL CREATE TABLE statements into Prisma schema models.
SQL CREATE TABLE to Prisma schema
Paste one or more SQL CREATE TABLE statements and this tool returns matching Prisma schema models — column types, primary keys, unique constraints and foreign-key relations included. It is built for developers migrating an existing PostgreSQL, MySQL or SQLite database into a Prisma project, or wiring up Prisma against a schema someone else designed in raw SQL.
Pick the source database so column types map correctly — a MySQL ENUM, a PostgreSQL UUID or a SQLite JSON column each need different handling, and the tool notes it inline when a type has no exact Prisma equivalent. Turn on singular PascalCase naming to get idiomatic model names (users becomes User) with an @@map back to the real table, and camelCase field names to get idiomatic Prisma fields (full_name becomes fullName) with an @map back to the real column — both are additive, so the underlying database schema never has to change. Foreign keys, whether declared inline, as a table-level constraint or via a separate ALTER TABLE statement, become proper Prisma relations on both sides, disambiguated with a named relation when more than one foreign key points at the same table.
Default values convert too: CURRENT_TIMESTAMP becomes @default(now()), AUTO_INCREMENT and SERIAL become @default(autoincrement()), and MySQL's ON UPDATE CURRENT_TIMESTAMP becomes @updatedAt. Nullable columns get a trailing question mark, composite keys become @@id, and composite or single-column unique constraints become @@unique or @unique depending on scope. Anything the converter can't represent exactly — an unsupported type, a CHECK constraint, an unsigned integer — is called out with a comment right above the affected field instead of being silently dropped or guessed at.
Everything runs locally in your browser: your schema is never uploaded anywhere, which matters if it describes a production database. Copy the result, download it as a .txt file to paste into schema.prisma, or send the output straight to another tool's input to keep refining it.