prisma1
prisma1 copied to clipboard
Programmatic usage of Prisma (reset, deploy, ...)
There is multiple issue about programmatic usage of Prisma.
#1948 #2214
Why people want programmatic usage of Prisma ?
- Build tools for Prisma ecosystem without "prisma-cli".
- Test GraphQL Yoga Server (deploy & wipe before each tests to ensure database is always fresh/consistent).
- Custom deployment strategy.
In a ideal world, Prisma generated client should be able to do Prisma CLI Cluster tasks like "reset", "deploy".
import { prisma } from './generated';
beforeAll(async () => {
return prisma.cluster.deploy();
});
afterAll(async () => {
return prisma.cluster.wipe();
});
The current workaround is calling Prisma CLI as child process but It's cumbersome and verbose + not "beginner" friendly.
Sorry to revive such an old issue, but this would be super helpful I believe. Where do you stand on this topic ?