Skip to content
Prisma ORM 7 Complete Reference
On Trove · from Prisma

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

What is Prisma ORM 7 Complete Reference?

markdown · Listed Feb 17, 2026

  • prisma
  • db
  • best-practices
  • skill

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

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