Home   prisma  

npx prisma generate in build step in CI CD

npx prisma generate is typically used in the build step of your project to generate the Prisma Client. Here’s how and when you would use it:

Purpose of npx prisma generate

  1. Generate Prisma Client:

    • The command npx prisma generate generates a Prisma Client based on your schema.prisma file. This client provides TypeScript/JavaScript functions for interacting with your database.
  2. Usage in Development:

    • During development, you often run npx prisma generate manually whenever you update your schema or make changes that require regenerating the Prisma Client. This ensures that your Prisma Client is always up to date with your schema definitions.
  3. Usage in CI/CD and Build Pipelines:

    • In CI/CD pipelines or build scripts (npm run build, etc.), you include npx prisma generate as a step to ensure that the Prisma Client is generated before deploying or running your application in production.

Example Usage

Published on: Jul 10, 2024, 12:38 AM  


Add your comment