PrismaP
Prisma2mo ago
1 reply
Up

Prisma 7 Setup with Cloudflare D1 Adapter

Hello, I'm trying to add prisma to a project that uses Cloudflare D1 database;

I've followed the provided steps which are
- add dotenv +
prisma
(dev)
- add
@prisma/client

- add @prisma/adapter-d1
- define DATABASE_URL in
.env

- pnpm exec prisma init --datasource-provider sqlite
- add runtime = "cloudflare" in schema.prisma
- pnpm exec wrangler d1 migrations create DB prisma_init
- pnpm exec prisma migrate diff --from-local-d1 --to-schema prisma/schema.prisma --script --output migrations/0005_prisma_init.sql

Now it seems that I cannot use --from-local-d1, despite the docs telling me to do so.

Also, The docs assume I have an empty database, which is not the case since this is an existing project. How do I add prisma without accidentally clearing out the DB?

---
using prisma 7.0.1
Was this page helpful?