prisma-driver-adapter-implementation

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

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

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 for implementing adapters against @prisma/driver-adapter-utils in Prisma ORM 7. ## Core Features & Use Cases - Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and optional savepoint hooks with correct connection lifecycle. - Result and Error Mapping: Covers argument mapping, column type metadata, DriverAdapterError conversion, and preserving originalCode/originalMessage for useful P2039 errors. - Transaction Safety: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, and connection-local savepoint handling. - Use Case: You are adding a new database driver adapter for Prisma 7 and need nested transactions, shadow database support for Migrate, and correct error mapping 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 and SqlDriverAdapter against the exact @prisma/driver-adapter-utils version of your target Prisma release. Provide queryRaw, executeRaw, executeScript, and startTransaction, mapping arguments, column types, and errors precisely.

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 or ROLLBACK, and savepoints live on the Transaction object.

Does the Prisma adapter contract 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.

Why does my Prisma adapter throw P2039 errors?

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

What are the limitations of splitting migration scripts on semicolons?

Naive semicolon splitting breaks functions, triggers, quoted strings, and dialect-specific blocks. executeScript should use the driver's native multi-statement facility or a real SQL parser matching the provider's expectations.