
Prisma ORM 7 Complete Reference
You can read the contents and the first 2,000 characters.
Free accounts get the whole book.
- By Sahar Carmel
- 127 chapters
- Updated Nov 1, 2026
- 57 readers
What’s inside
- Database Setup
- Prisma Database Setup
- PostgreSQL Setup
- MySQL Setup
- SQLite Setup
- MongoDB Setup
From the first page
A comprehensive reference guide for Prisma ORM 7, compiled from the official Prisma skills repository. Covers database setup, CLI commands, Client API, upgrading from v6 to v7, and Prisma Postgres.
1. Database Setup 2. CLI Reference 3. Client API Reference 4. Upgrade to Prisma v7 5. Prisma Postgres
Comprehensive guides for configuring Prisma ORM with various database providers.
Reference this skill when: - Initializing a new Prisma project - Switching database providers - Configuring connection strings and environment variables - Troubleshooting database connection issues - Setting up database-specific features - Generating and instantiating Prisma Client
If you're using Bun, run Prisma CLI commands with bunx --bun prisma ... so Prisma uses the Bun runtime instead of falling back to Node.js.
Preview · 2,000 of 141,228 characters
Contents
- 01Prisma ORM 7 Complete Referencep.1
- Table of Contentsp.1
- 02Database Setupp.2
- 03Prisma Database Setupp.3
- When to Applyp.3
- Rule Categories by Priorityp.3
- System Prerequisites (Prisma ORM 7)p.3
- Bun Runtimep.3
- Supported Databasesp.3
- Configuration Filesp.3
- Driver Adapters (Prisma ORM 7)p.3
- Prisma Client Setup (Required)p.3
- +3 more sections
- 04PostgreSQL Setupp.4
- Prerequisitesp.4
- 1. Schema Configurationp.4
- 2. Config Configuration (v7)p.4
- 3. Environment Variablep.4
- Driver Adapter (Prisma ORM 7 required)p.4
- Common Issuesp.4
- 05MySQL Setupp.5
- Prerequisitesp.5
- 1. Schema Configurationp.5
- 2. Config Configuration (v7)p.5
- 3. Environment Variablep.5
- Driver Adapter (Prisma ORM 7 required)p.5
- PlanetScale Setupp.5
- Common Issuesp.5
- 06SQLite Setupp.6
- Prerequisitesp.6
- 1. Schema Configurationp.6
- 2. Config Configuration (v7)p.6
- 3. Environment Variablep.6
- Driver Adapter (Prisma ORM 7 required)p.6
- Using Driver Adapter (LibSQL / Turso)p.6
- Limitationsp.6
- Common Issuesp.6
- 07MongoDB Setupp.7
- Prerequisitesp.7
- 1. Schema Configuration (v6)p.7
- 2. Environment Variablep.7
- Migrations vs Introspectionp.7
- Common Issuesp.7
- 08SQL Server Setupp.8
- Prerequisitesp.8
- 1. Schema Configurationp.8
- 2. Config Configuration (v7)p.8
- 3. Environment Variablep.8
- Driver Adapter (Prisma ORM 7 required)p.8
- Common Issuesp.8
See all 127 parts
- 09CockroachDB Setupp.9
- Prerequisitesp.9
- 1. Schema Configurationp.9
- 2. Config Configuration (v7)p.9
- 3. Environment Variablep.9
- Driver Adapter (Prisma ORM 7 required)p.9
- ID Generationp.9
- Common Issuesp.9
- 10Prisma Postgres Setupp.10
- Overviewp.10
- Setup via CLIp.10
- Connection Stringp.10
- 1. Schema Configurationp.10
- 2. Config Configurationp.10
- Driver Adapter (Prisma ORM 7 required)p.10
- Featuresp.10
- Using with Prisma Clientp.10
- 11Prisma Client Setupp.11
- 1. Install dependenciesp.11
- 2. Add generator blockp.11
- 3. Generate Prisma Clientp.11
- 4. Instantiate Prisma Clientp.11
- 5. Use a single instancep.11
- 12CLI Referencep.12
- 13Prisma CLI Referencep.13
- When to Applyp.13
- Rule Categories by Priorityp.13
- Command Categoriesp.13
- Quick Referencep.13
- 14Initialize new project (creates prisma/ folder and prisma.config.ts)p.14
- 15Initialize with specific databasep.15
- 16Initialize with Prisma Postgres (cloud)p.16
- 17Initialize with AI-generated schemap.17
- Client Generationp.17
- 18Generate Prisma Clientp.18
- 19Watch mode for developmentp.19
- 20Generate without engine (for Accelerate/edge)p.20
- 21Generate specific generator onlyp.21
- Bun Runtimep.21
- Local Development Databasep.21
- 22Start local Prisma Postgresp.22
- 23Start with specific namep.23
- 24Start in background (detached)p.24
- 25List all local instancesp.25
- 26Stop instancep.26
- 27Remove instance datap.27
- Database Operationsp.27
- 28Pull schema from existing databasep.28
- 29Push schema to database (no migrations)p.29
- 30Seed databasep.30
- 31Execute raw SQLp.31
- Migrations (Development)p.31
- 32Create and apply migrationp.32
- 33Create migration with namep.33
- 34Create migration without applyingp.34
- 35Reset database and apply all migrationsp.35
- Migrations (Production)p.35
- 36Apply pending migrations (CI/CD)p.36
- 37Check migration statusp.37
- 38Compare schemas and generate diffp.38
- Utility Commandsp.38
- 39Open Prisma Studio (database GUI)p.39
- 40Show version infop.40
- 41Debug informationp.41
- 42Validate schemap.42
- 43Format schemap.43
- Prisma 7 Changesp.43
- Rule Filesp.43
- How to Usep.43
- 44prisma initp.44
- Commandp.44
- Bun Runtimep.44
- What It Createsp.44
- Optionsp.44
- Examplesp.44
- Generated Schema (v7)p.44
- Generated Config (v7)p.44
- Next Steps After Initp.44
- 45prisma generatep.45
- Commandp.45
- Bun Runtimep.45
- What It Doesp.45
- Optionsp.45
- Examplesp.45
- Schema Configuration (v7)p.45
- Common Patternsp.45
- Output Structurep.45
- 46prisma devp.46
- Commandp.46
- What It Doesp.46
- Optionsp.46
- Examplesp.46
- Instance Managementp.46
- Configurationp.46
- Workflowp.46
- Production Migrationp.46
- 47prisma db pullp.47
- Commandp.47
- What It Doesp.47
- Optionsp.47
- Examplesp.47
- Prerequisitesp.47
- Workflowp.47
- Generated Schema Examplep.47
- Post-Introspection Cleanupp.47
- +2 more sections
- 48prisma db pushp.48
- Commandp.48
- What It Doesp.48
- Optionsp.48
- Examplesp.48
- When to Usep.48
- When NOT to Usep.48
- Comparison with migrate devp.48
- MongoDB Workflowp.48
- 49Schema changes for MongoDBp.49
- Common Patternsp.49
- 50Make schema changesp.50
- 51...p.51
- 52Push to databasep.52
- 53Generate clientp.53
- 54Test your changesp.54
- 55Repeat as neededp.55
- Transition to Migrationsp.55
- 56Create baseline migration from current schemap.56
- 57prisma db seedp.57
- Commandp.57
- What It Doesp.57
- Optionsp.57
- Configurationp.57
- Seed Script Examplep.57
- Examplesp.57
- v7 Changesp.57
- 58v7 workflowp.58
- Idempotent Seedingp.58
- Common Patternsp.58
- Best Practicesp.58
- 59prisma db executep.59
- Commandp.59
- What It Doesp.59
- Optionsp.59
- Examplesp.59
- Configurationp.59
- Use Casesp.59
- Limitationsp.59
- 60prisma migrate devp.60
- Commandp.60
- What It Doesp.60
- Optionsp.60
- Examplesp.60
- Migration Filesp.60
- Schema Drift Detectionp.60
- When to Usep.60
- When NOT to Usep.60
- +1 more section
- 61Warning: You are about to delete data...p.61
- 62Accept with: --accept-data-lossp.62
- Shadow Databasep.62
- 63prisma migrate deployp.63
- Commandp.63
- What It Doesp.63
- Optionsp.63
- When to Usep.63
- Examplesp.63
- 64GitHub Actions examplep.64
- Docker deploymentp.64
- 65Run migrations before starting appp.65
- Comparison with migrate devp.65
- Production Workflowp.65
- Error Handlingp.65
- Configurationp.65
- Best Practicesp.65
- 66prisma migrate diffp.66
- Commandp.66
- What It Doesp.66
- Optionsp.66
- Examplesp.66
- Use Casesp.66
- 67prisma migrate resetp.67
- Commandp.67
- What It Doesp.67
- Optionsp.67
- Examplesp.67
- When to Usep.67
- Behavior in v7p.67
- Configurationp.67
- 68prisma migrate resolvep.68
- Commandp.68
- What It Doesp.68
- Optionsp.68
- Examplesp.68
- Use Casesp.68
- Referencesp.68
- 69prisma migrate statusp.69
- Commandp.69
- What It Doesp.69
- Optionsp.69
- Examplesp.69
- When to Usep.69
- Exit Codesp.69
- 70prisma studiop.70
- Commandp.70
- What It Doesp.70
- Optionsp.70
- Examplesp.70
- Featuresp.70
- Use Casesp.70
- Limitationsp.70
- Common Workflowp.70
- +1 more section
- 71prisma validatep.71
- Commandp.71
- What It Doesp.71
- Optionsp.71
- Examplesp.71
- Common Errorsp.71
- 72prisma formatp.72
- Commandp.72
- What It Doesp.72
- Optionsp.72
- Examplesp.72
- Behaviorp.72
- Use in Editorp.72
- 73prisma debugp.73
- Commandp.73
- What It Doesp.73
- Optionsp.73
- Example Outputp.73
- When to Usep.73
- 74Client API Referencep.74
- 75Prisma Client API Referencep.75
- When to Applyp.75
- Rule Categories by Priorityp.75
- Quick Referencep.75
- Client Instantiation (v7)p.75
- Model Query Methodsp.75
- Query Optionsp.75
- Client Methodsp.75
- Quick Examplesp.75
- +5 more sections
- 76PrismaClient Constructorp.76
- Basic Instantiation (v7)p.76
- Constructor Optionsp.76
- Singleton Patternp.76
- Next.js Patternp.76
- Query Eventsp.76
- Log Eventsp.76
- 77Model Queriesp.77
- Read Operationsp.77
- Create Operationsp.77
- Update Operationsp.77
- Delete Operationsp.77
- Aggregation Operationsp.77
- Return Typesp.77
- 78Query Optionsp.78
- selectp.78
- includep.78
- omitp.78
- wherep.78
- orderByp.78
- take & skipp.78
- cursorp.78
- distinctp.78
- 79Filter Conditions and Operatorsp.79
- Equalityp.79
- Comparisonp.79
- Listsp.79
- String Filtersp.79
- Null Checksp.79
- Logical Operatorsp.79
- Relation Filtersp.79
- Array Field Filtersp.79
- +2 more sections
- 80Relation Queriesp.80
- Include Relationsp.80
- Select Relationsp.80
- Nested Writesp.80
- Update Relationsp.80
- Relation Filtersp.80
- Count Relationsp.80
- 81Transactionsp.81
- Sequential Transactionsp.81
- Interactive Transactionsp.81
- Nested Writesp.81
- Transaction Clientp.81
- OrThrow in Transactionsp.81
- Best Practicesp.81
- Sequential vs Interactivep.81
- 82Raw Queriesp.82
- $queryRawp.82
- $executeRawp.82
- $queryRawUnsafe / $executeRawUnsafep.82
- SQL Injection Preventionp.82
- Database-Specific Featuresp.82
- Transactions with Raw Queriesp.82
- Handling Resultsp.82
- 83Client Methodsp.83
- $connect()p.83
- $disconnect()p.83
- $on()p.83
- $extends()p.83
- $transaction()p.83
- $queryRaw() / $executeRaw()p.83
- Type utilitiesp.83
- 84Upgrade to Prisma v7p.84
- 85Upgrade to Prisma ORM 7p.85
- When to Applyp.85
- Rule Categories by Priorityp.85
- Quick Referencep.85
- Important Notesp.85
- Upgrade Steps Overviewp.85
- Quick Upgrade Commandsp.85
- 86Update packagesp.86
- 87Install driver adapter (PostgreSQL example)p.87
- 88Install dotenv for env loadingp.88
- 89Regenerate clientp.89
- Breaking Changes Summaryp.89
- Rule Filesp.89
- Step-by-Step Migrationp.89
- 90PostgreSQLp.90
- 91MySQLp.91
- 92SQLitep.92
- 93Prisma Postgresp.93
- 94Neonp.94
- Troubleshootingp.94
- Resourcesp.94
- How to Usep.94
- 95Schema Changesp.95
- Generator Block (v7)p.95
- Key Changesp.95
- Example Output Paths (prisma-client)p.95
- Datasource Blockp.95
- After Schema Changesp.95
- Preview Featuresp.95
- 96Driver Adaptersp.96
- Why Driver Adapters?p.96
- Available Adaptersp.96
- Installationp.96
- Configurationp.96
- Connection Pool Configurationp.96
- SSL Configurationp.96
- Migration from v6p.96
- Singleton Patternp.96
- 97ESM Supportp.97
- Required Changesp.97
- Import Syntax Changesp.97
- Minimum Versionsp.97
- CommonJS Compatibilityp.97
- Framework Considerationsp.97
- Troubleshootingp.97
- 98Prisma Configp.98
- Locationp.98
- Basic Configurationp.98
- Configuration Optionsp.98
- Full Examplep.98
- Environment Variablesp.98
- Migrating from v6p.98
- Custom Config Pathp.98
- Monorepo Configurationp.98
- 99Environment Variablesp.99
- The Changep.99
- Setupp.99
- Bun Usersp.99
- Multiple .env Filesp.99
- Application Codep.99
- Removed Environment Variablesp.99
- TypeScript env() Helperp.99
- CI/CD Considerationsp.99
- 100GitHub Actionsp.100
- 101Removed Featuresp.101
- Client Middlewarep.101
- Metricsp.101
- CLI Flags Removedp.101
- 102v6p.102
- 103v7 - generate is not run automaticallyp.103
- --skip-seedp.103
- 104v6p.104
- 105v7 - seed is not run automaticallyp.105
- --schema and --url from db executep.105
- 106v6p.106
- 107v7 - configure in prisma.config.tsp.107
- migrate diff Optionsp.107
- 108v6p.108
- 109v7p.109
- Automatic Behaviors Removedp.109
- 110v7 workflowp.110
- Auto-seed after migratep.110
- 111v7 workflowp.111
- rejectOnNotFoundp.111
- 112Prisma Accelerate Usersp.112
- Importantp.112
- Correct v7 Setup for Acceleratep.112
- 113.envp.113
- 114orp.114
- What NOT to Dop.114
- Migrations with Acceleratep.114
- 115Works with Accelerate URLp.115
- Prisma Postgres (Cloud)p.115
- Switching Away from Acceleratep.115
- Caching with Acceleratep.115
- Edge Runtimep.115
- 116Prisma Postgresp.116
- 117Prisma Postgresp.117
- When to Applyp.117
- Rule Categories by Priorityp.117
- Quick Referencep.117
- Core Workflowsp.117
- Rule Filesp.117
- How to Usep.117
- 118console-and-connectionsp.118
- Priorityp.118
- Why It Mattersp.118
- Console workflowp.118
- Local Studiop.118
- Connection setupp.118
- Referencesp.118
- 119create-db-clip.119
- Priorityp.119
- Why It Mattersp.119
- Commandsp.119
- Command discovery (`--help`)p.119
- `create` optionsp.119
- Lifecycle and claim flowp.119
- Programmatic usage (library API)p.119
- 120orp.120
- Common patternsp.120
- 121quick databasep.121
- 122region-specific databasep.122
- 123interactive region selectionp.123
- 124write env vars for app bootstrapp.124
- 125CI-friendly outputp.125
- Referencesp.125
- 126management-apip.126
- Priorityp.126
- Why It Mattersp.126
- Base URLp.126
- API explorationp.126
- Authentication methodsp.126
- Service token flowp.126
- OAuth flow summaryp.126
- Common endpointsp.126
- +2 more sections
- 127management-api-sdkp.127
- Priorityp.127
- Why It Mattersp.127
- Installp.127
- Simple client (existing token)p.127
- Full SDK (OAuth + refresh)p.127
- OAuth SDK flowp.127
- Referencesp.127



