SQL DDL to Prisma Schema
Converts CREATE TABLE statements into a schema.prisma with models, @id, @default, @unique, @map, native types, composite keys, indexes and foreign keys as relations with back-relation lists.
Use the tool
Why this tool exists
If you already have a database and want to start using Prisma, the usual route is prisma db pull, which needs a live connection. Often you only have a schema dump, a migration file or DDL pasted from a ticket. This tool reads the CREATE TABLE statements and writes a first schema.prisma: models, id and unique attributes, autoincrement and now() defaults, @map and @@map so snake_case columns keep their names, native types where needed, composite keys and indexes. Foreign keys become @relation fields and the back-relation lists are added for you. Read the result carefully, since naming and relation choices are guesses. It all runs in your browser, so no database is contacted.
How to use it
- Paste your CREATE TABLE statements into the input box.
- Run the conversion to get the Prisma models.
- Copy the schema into schema.prisma, add the datasource and generator blocks, and run prisma validate.
Frequently asked questions
Do I need a database connection?
No. The tool reads only the DDL text you paste. For a live database, prisma db pull is the official route.
How are snake_case columns handled?
Field names are converted to camelCase, and @map or @@map keeps the original column and table names so the mapping stays correct.
Are relations created?
Yes. Foreign keys become @relation fields, and the opposite side gets a list field automatically. Multiple keys to the same table are given distinct relation names.
Is the schema ready to use?
Treat it as a draft. Add the datasource and generator blocks, and run prisma validate and prisma format to catch anything that needs adjusting.