prisma-driver-adapter-implementation

Implements Prisma ORM 7 SQL driver adapters with transaction, savepoint, and error-mapping contracts.

Updated Aug 7, 2026
One-click install
npx skills add https://github.com/Sambhav242005/Major-Project --skill prisma-driver-adapter-implementation-sambhav242005
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/Sambhav242005/Major-Project/tree/main/apps/web/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/Sambhav242005/Major-Project --skill prisma-driver-adapter-implementation-sambhav242005

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @prisma/driver-adapter-utils.

What problem does it solve? Building a Prisma SQL driver adapter is error-prone: type-compatible code can still corrupt values, leak connections, break transactions, or lose original database error details. This Skill provides the exact contract, priority rules, and verification checklist needed to implement adapters that behave correctly with Prisma Client and Migrate. ## Core Features & Use Cases - Adapter Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and migration-aware shadow database factories against the installed @prisma/driver-adapter-utils version. - Transaction & Savepoint Protocol: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, and connection-local savepoint handling for nested transactions. - Result & Error Mapping: Covers argument/column type mapping, 64-bit integer precision, and DriverAdapterError conversion that preserves originalCode and originalMessage for useful P2039 errors. - Use Case: You are writing a new database driver adapter for Prisma 7 and hitting P2039 errors or transaction leaks; use this Skill to audit your transaction lifecycle, savepoint hooks, and error mapping against the official protocol. ## Quick Start Ask the AI to review or implement a Prisma driver adapter's transaction and error-mapping code using this Skill's contract and verification checklist.

Frequently Asked Questions about prisma-driver-adapter-implementation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a Prisma driver adapter for a new database?

Implement SqlDriverAdapterFactory with a connect() method returning a SqlDriverAdapter that provides queryRaw, executeRaw, executeScript, and startTransaction. Match the exact @prisma/driver-adapter-utils version of your target Prisma release and follow the transaction and error-mapping contract.

How do Prisma driver adapter transactions and savepoints work?

startTransaction must acquire one dedicated connection, begin the transaction, and apply the isolation level. commit() and rollback() are lifecycle hooks that release the connection once; Prisma issues the actual SQL COMMIT/ROLLBACK via executeRaw, and savepoints are optional methods on the Transaction object.

Why does my Prisma adapter throw P2039 errors?

P2039 surfaces when an unmapped driver error reaches Prisma. Wrap driver failures in DriverAdapterError and preserve originalCode and originalMessage so the fallback error remains useful, and rethrow genuinely unexpected non-driver errors instead of fabricating GenericJs ids.

Does a Prisma driver adapter need shadow database support?

Only if you implement SqlMigrationAwareDriverAdapterFactory for Prisma Migrate. Its connectToShadowDb() must create an isolated shadow database with a unique quoted name, never point at the primary database, and clean it up on disposal or failure.

What are common mistakes when mapping query results in driver adapters?

Common mistakes include truncating 64-bit integers into JS numbers, misaligning columnNames, columnTypes, and rows, and splitting migration scripts on semicolons. Map each argument using both its value and ArgType, and use the driver's native multi-statement facility for executeScript.