prisma-driver-adapter-implementation

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

1|Updated Jun 5, 2026
One-click install
npx skills add https://github.com/sristigupta04/Airbnb-app --skill prisma-driver-adapter-implementation-sristigupta04
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/sristigupta04/Airbnb-app/tree/main/Full-stack/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/sristigupta04/Airbnb-app --skill prisma-driver-adapter-implementation-sristigupta04

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Building a Prisma driver adapter is a protocol-boundary task where type-compatible code can still corrupt values, leak connections, or break transactions. This Skill provides the exact contract, lifecycle rules, and verification checklist needed to implement or modify Prisma ORM 7 SQL driver adapters correctly. ## Core Features & Use Cases - Adapter Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and migration-aware shadow database factories. - Transaction & Savepoint Protocol: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, and connection-local savepoint handling. - Error & Result Mapping: Preserves original database error codes for useful P2039 fallbacks and maps column types, arguments, and result metadata without silent corruption. - Use Case: When adding a new database driver to Prisma or debugging P2039 errors, transaction leaks, or shadow-database failures in an existing adapter, follow this guide to implement and verify the adapter against the target @prisma/driver-adapter-utils version. ## Quick Start Ask the AI to implement a Prisma driver adapter for your database driver following the transaction, savepoint, 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, SqlDriverAdapter, and Transaction against the exact @prisma/driver-adapter-utils version of your target Prisma release. Map query arguments and result column types precisely, and follow the transaction lifecycle rules for commit, rollback, and savepoints.

How should transactions work in a Prisma driver adapter?

startTransaction must acquire one dedicated connection, begin the transaction, apply the isolation level, and return a Transaction bound to that connection. The commit() and rollback() methods are lifecycle cleanup hooks that release the connection once; Prisma issues the actual SQL COMMIT or ROLLBACK through executeRaw.

Does the Prisma adapter Transaction interface support savepoints?

Yes, Transaction optionally supports createSavepoint, rollbackToSavepoint, and releaseSavepoint for providers that support them. Savepoint state must live on the transaction's connection, never as adapter-global depth, and identifiers must be validated or quoted.

Why does my Prisma adapter throw P2039 errors?

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

What is a shadow database in Prisma driver adapters?

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