Preflight schema changes
Check a schema after editing it and before generating a client or applying database changes.
Prisma · Command
prisma validate checks a Prisma schema for Prisma Schema Language syntax errors and configuration issues. Optional flags let you select a custom schema or Prisma config file.
The command loads a Prisma schema and checks its Prisma Schema Language plus configuration for errors. Use --schema to validate a different schema file or --config to select a Prisma configuration file.
prisma validate [options]| Name | Type | Description |
|---|---|---|
-h, --help | option | Display help message |
--config | option | Custom path to your Prisma config file |
--schema | option | Custom path to your Prisma schema |
A validation result in the CLI: either confirmation that the loaded schema is valid or diagnostics for schema/configuration errors.
npx prisma validate --schema=./prisma/schema.prismaRun this from a project containing the default Prisma schema to check its syntax and configuration.
Check a schema after editing it and before generating a client or applying database changes.
Validate a schema stored outside the default location.
Run validation in a project that uses a non-default Prisma configuration file.
It validates the Prisma Schema Language in the schema file and checks for syntax or configuration problems. A successful run reports that the schema is valid.
Follow-up: How would you validate a non-default schema? Use --schema with its relative or absolute path.
Use the --schema option followed by the desired schema path, for example npx prisma validate --schema=./alternative/schema.prisma. This lets validation target a file other than the default schema location.
Follow-up: What other path-related option is available? Use --config to specify a custom Prisma config file.
Use --config to point Prisma at a custom configuration file, such as npx prisma validate --config=./prisma.config.ts. The config file can locate the schema and other Prisma resources.
Follow-up: How are paths in the config interpreted? They are resolved relative to the config file's location, not the directory where the command is run.
prisma formatprisma migrateprisma generatePrisma Schema Language