prisma-driver-adapter-implementation

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

Updated Aug 10, 2026
One-click install
npx skills add https://github.com/AlvaroCG123/BancoAtividade --skill prisma-driver-adapter-implementation-alvarocg123
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/AlvaroCG123/BancoAtividade/tree/main/AtividadeBanco/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/AlvaroCG123/BancoAtividade --skill prisma-driver-adapter-implementation-alvarocg123

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 under Prisma ORM 7. ## Core Features & Use Cases - Adapter Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and SqlMigrationAwareDriverAdapterFactory with correct query, script, and lifecycle semantics. - Transaction & Savepoint Protocol: Enforces one dedicated connection per transaction, commit/rollback as cleanup hooks, and connection-local savepoint handling for nested transactions. - Error & Result Mapping: Preserves original database error codes and messages for useful P2039 fallbacks, and maps column types, arguments, and native types without silent value corruption. - Use Case: You are writing a new database driver adapter for Prisma 7 and need to support interactive transactions, shadow databases for Migrate, and structured constraint errors without leaking pooled connections. ## Quick Start Ask the AI to implement a Prisma 7 SQL driver adapter for your database driver following the transaction, savepoint, and error-mapping rules in this Skill.

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 connect(), then SqlDriverAdapter with queryRaw, executeRaw, executeScript, startTransaction, and dispose. Typecheck against the exact @prisma/driver-adapter-utils version shipped with your target Prisma release.

How do Prisma driver adapter transactions and savepoints work?▼

startTransaction acquires one dedicated connection, begins the transaction, and applies the isolation level. commit() and rollback() are lifecycle cleanup hooks that release the connection once; Prisma issues the actual SQL COMMIT or ROLLBACK via executeRaw, and savepoints are optional methods on the Transaction object.

Does the Prisma adapter interface support nested transactions?▼

Yes, through optional createSavepoint, rollbackToSavepoint, and releaseSavepoint methods on the Transaction object. Implement them only where the provider supports savepoints, and never track transaction depth on the shared adapter since parallel transactions make global depth incorrect.

Why does my Prisma adapter throw P2039 errors?▼

P2039 surfaces when an unmapped driver error reaches Prisma. Preserve originalCode and originalMessage in your DriverAdapterError so the fallback is useful, map known conditions to structured MappedError kinds, and rethrow genuinely unexpected non-driver errors instead of fabricating GenericJs ids.

How should a Prisma adapter handle shadow databases for migrations?▼

Implement SqlMigrationAwareDriverAdapterFactory only if connectToShadowDb() can create an isolated shadow database, connect to it, and drop it during disposal or failure cleanup. Never point the shadow adapter at the primary database, and use quoted, cryptographically unique identifiers.