Skip to main content
Prisma Documentation Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

format (Prisma CLI v7)

Format and validate your Prisma schema file with consistent structure

The prisma format command formats your Prisma schema file. It validates, formats, and persists the schema.

Bash
prisma format [options]
Option Description
-h, --help Display help message
--config Custom path to your Prisma config file
--schema Custom path to your Prisma schema
bun
bunx prisma format
pnpm
pnpm prisma format
yarn
yarn prisma format
npm
npx prisma format

Output on success:

text
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Formatted prisma/schema.prisma in 116ms
bun
bunx prisma format --schema=./alternative/schema.prisma
pnpm
pnpm prisma format --schema=./alternative/schema.prisma
yarn
yarn prisma format --schema=./alternative/schema.prisma
npm
npx prisma format --schema=./alternative/schema.prisma

If the schema has validation errors, formatting will fail:

text
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: Schema validation error - Error (query-engine-node-api library)
Error code: P1012
error: The preview feature "unknownFeatureFlag" is not known. Expected one of: [...]
  schema.prisma:3
   |
 2 |     provider        = "prisma-client"
 3 |     previewFeatures = ["unknownFeatureFlag"]
   |

Validation Error Count: 1
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu