Update generated client
Build or refresh Prisma Client after changing models or generator configuration.
Prisma · Command
Generates artifacts such as Prisma Client from the generator and data model blocks in a Prisma schema. It can target a custom schema, select generators, generate typed SQL, or watch for changes.
The command locates a Prisma schema, runs the generators declared in it, and writes generated assets—commonly Prisma Client—to each generator's configured output directory. Use options to select a schema, restrict generators, generate typed SQL, or watch for schema changes.
prisma generate [options]| Name | Type | Description |
|---|---|---|
options | flags | Optional command-line flags controlling schema selection, generator selection, watch mode, SQL generation, hints, and model requirements. |
Generated artifacts such as Prisma Client, written to the output directory configured by each generator.
--generator options.--schema when the schema is outside the command's default discovery location.--sql option adds generation of a typed SQL module.--watch keeps the command running and regenerates when the schema changes; it is not a one-shot invocation.generator client {
provider = "prisma-client"
output = "./generated"
}
// Run: bunx prisma generate
A generator block defines the Prisma Client provider and output directory; the command generates the client there.
Build or refresh Prisma Client after changing models or generator configuration.
Keep generated artifacts synchronized during schema development.
Generate from a schema stored outside the default location.
Produce typed SQL alongside other generated assets.
prisma generate do?It reads the Prisma schema, finds the configured generator blocks, and creates the requested artifacts in the output directories declared by those generators. Prisma Client is the common generated artifact.
Follow-up: How would you generate only one configured generator? Use prisma generate --generator <name>; the option can be supplied multiple times when selecting several generators.
The basic form is prisma generate [options]. Common options include --schema for a custom schema path, --generator to select generators, --watch to regenerate after changes, and --sql for a typed SQL module.
Follow-up: How can you generate from a non-default schema? Pass its path explicitly, for example prisma generate --schema=./alternative/schema.prisma.
The command uses the generator configuration in the target schema, including the provider and output directory. A prisma-client generator can therefore emit a customized client at the configured path.
Follow-up: What prevents accidental client generation without models? Use --require-models, which disallows generating a client when the schema has no models.
prisma-clientgenerator blockschema.prisma--schema--generator--watch--sql