prisma-driver-adapter-implementation

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

Updated Aug 31, 2026
One-click install
npx skills add https://github.com/Akhand0ps/vecta --skill prisma-driver-adapter-implementation-akhand0ps
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/Akhand0ps/vecta/tree/main/packages/db/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/Akhand0ps/vecta --skill prisma-driver-adapter-implementation-akhand0ps

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, or break transactions. This Skill provides the exact contract, priority rules, and verification checklist needed to implement adapters that behave correctly under Prisma ORM 7. ## Core Features & Use Cases - Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and optional savepoint hooks with correct lifecycle semantics. - Error & Result Mapping: Shows how to map driver values, column metadata, and database errors into DriverAdapterError while preserving original codes for P2039 fallbacks. - Transaction Safety: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, and isolated shadow databases for migrations. - Use Case: When adding a new database driver to Prisma, follow this guide to implement queryRaw, executeRaw, startTransaction, and connectToShadowDb, then validate against the included checklist before running Prisma Client integration tests. ## Quick Start Ask the AI to implement a Prisma SQL driver adapter for your database driver following the transaction and error-mapping rules in this guide.

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, startTransaction, and dispose. Match the exact @prisma/driver-adapter-utils version of your target Prisma release and follow the transaction lifecycle rules.

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 cleanup hooks only; Prisma issues the SQL COMMIT/ROLLBACK itself. Savepoint methods live on the Transaction object, never as adapter-global depth.

Does the Prisma driver adapter support nested transactions?

Yes, through optional createSavepoint, rollbackToSavepoint, and releaseSavepoint methods on the Transaction interface. Implement them only where the database provider supports savepoints, and validate or quote savepoint identifiers.

Why does my Prisma adapter throw P2039 errors?

P2039 surfaces when an unmapped driver error reaches Prisma. Wrap known database errors in DriverAdapterError with mapped kinds, and always preserve originalCode and originalMessage so the P2039 fallback remains useful.

What is a shadow database in Prisma driver adapters?

A shadow database is an isolated database created by connectToShadowDb() for migration validation. It must use cryptographically unique quoted names, never point at the primary database, and be dropped during disposal or failure cleanup.