Prisma Schema to SQL DDL
Converts a schema.prisma into CREATE TABLE statements for PostgreSQL, MySQL or SQLite, covering models, enums, @id, @unique, @default, @map, @relation foreign keys and indexes.
Use the tool
Why this tool exists
Prisma generates SQL through migrations, but sometimes you just want to see the DDL: to review what a schema means in plain SQL, to hand it to a DBA, to set up a database without Node, or to compare with a legacy schema. Running prisma migrate needs a project, a connection and a shadow database. Paste the schema here instead and get the CREATE TABLE statements, using Prisma's default type mappings, the dialect from the datasource block or one you pick. Names from @map and @@map are used, relations become foreign keys and indexes are written out. Client-side defaults such as uuid() and cuid() produce no SQL default, as in Prisma itself. Nothing leaves your browser.
How to use it
- Paste your schema.prisma, including the datasource block and models, into the input box.
- Choose "from datasource" or pick PostgreSQL, MySQL or SQLite.
- Review the CREATE TABLE statements and use them as a reference or starting point.
Frequently asked questions
Does it match what prisma migrate produces?
It follows Prisma's default mappings, such as String to text, or varchar(191) on MySQL. Migrations can differ in details like constraint names, so use the output as a guide, not a byte-for-byte match.
How are relations converted?
Fields with @relation, fields and references become foreign key constraints, with onDelete actions where specified. List-side relation fields produce no columns.
What happens to uuid() and cuid() defaults?
These run in Prisma's client, not in the database, so no SQL default is generated for them. Autoincrement and now() are converted.
Are enums supported?
Yes. Enums are created as database enums where the dialect supports them, and mapped in other ways where it does not. Check the result for your dialect.