Binary Location
After building:Interfaces
The schema engine provides two interfaces:- JSON-RPC Server (default) - For interactive communication from the Prisma CLI
- CLI Commands - For standalone database operations
JSON-RPC Server Mode
When run without arguments, the schema engine starts as a JSON-RPC server:Command Line Options
List of paths to Prisma schema files
Optional JSON string to override datasource URLs in the schema. Format:
Optional extension type configuration for TypedSQL and other extensions
JSON-RPC Methods
The schema engine exposes these JSON-RPC methods:Migration Operations
createMigration- Generate a new migration from schema changesapplyMigrations- Apply pending migrations to the databaseunapplyMigration- Revert the last migrationlistMigrationDirectories- List all migrations in the migrations directorymarkMigrationApplied- Mark a migration as applied without running itmarkMigrationRolledBack- Mark a migration as rolled backdevDiagnostic- Analyze migration history for developmentdiagnoseMigrationHistory- Check migration history statusevaluateDataLoss- Analyze potential data loss in pending migrations
Schema Operations
schemaPush- Push schema changes without creating migrationsreset- Reset the database to a clean stateintrospect- Generate a Prisma schema from an existing database
Database Operations
createDatabase- Create a new databasedropDatabase- Drop the databaseensureConnectionValidity- Test database connection
Diffing Operations
diff- Compare two schemas and generate a migration script
CLI Commands
Standalone commands that don’t require a running server:create-database
Create an empty database defined in the connection string:Database 'mydb' was successfully created.
can-connect-to-database
Test if the database connection string works:Connection successful
drop-database
Drop the database:The database was successfully dropped.
Logging and Error Reporting
The schema engine outputs structured JSON logs to stderr:Log Levels
Control logging with theRUST_LOG environment variable:
Exit Codes
Normal exit - operation completed successfully
Abnormal exit - operation failed with an error
Panic - the engine crashed due to an unrecoverable error
Non-zero exit codes are always accompanied by an ERROR-level log message on stderr.
Environment Variables
Timeout for graceful shutdown of async tasks on SIGTERM
Deadline for blocking background tasks during shutdown
Configure logging verbosity (e.g.,
debug, schema_core=trace)Building the Binary
Integration with Prisma CLI
The TypeScript Prisma CLI spawns the schema-engine binary and communicates via JSON-RPC:Related Documentation
Schema Engine Overview
Learn about the schema engine architecture
Migrations
Understand how migrations work
Introspection
Database schema introspection
Schema Core Library
Core API reference