prisma1 icon indicating copy to clipboard operation
prisma1 copied to clipboard

Programmatic usage of Prisma (reset, deploy, ...)

Open arialpew opened this issue 7 years ago • 1 comments

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.

arialpew avatar Nov 25 '18 09:11 arialpew

Sorry to revive such an old issue, but this would be super helpful I believe. Where do you stand on this topic ?

enzoferey avatar Feb 23 '20 12:02 enzoferey