- Generates a Drizzle schema from a Prisma schema file
- Generates Drizzle relations (one-to-one, one-to-many, many-to-one, many-to-many)
- Supports disambiguation relations
- MySQL
- PostgreSQL (TBD)
- SQLite (TBD)
Install the generator as a development dependency:
npm install -D prisma-to-drizzle-generator
yarn add -D prisma-to-drizzle-generator
pnpm install -D prisma-to-drizzle-generator
Add the generator to your Prisma schema:
generator drizzle {
provider = "prisma-to-drizzle-generator"
output = "./drizzle/schema.ts"
}
Run the generator:
prisma generate
The generator supports a compat mode if you are using or migrating from database managed by prisma:
generator drizzle {
provider = "prisma-to-drizzle-generator"
output = "./drizzle/schema.ts"
compat = true
}
If you have any questions or suggestions, please open an issue or a pull request.