prisma-driver-adapter-implementation

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

Updated Aug 30, 2026
One-click install
npx skills add https://github.com/Rashidrxq/SalesOrder-ERP-REMEX --skill prisma-driver-adapter-implementation-rashidrxq
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/Rashidrxq/SalesOrder-ERP-REMEX/tree/main/sales_order/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/Rashidrxq/SalesOrder-ERP-REMEX --skill prisma-driver-adapter-implementation-rashidrxq

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 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 P2039 fallback and maps column types, arguments, and native types without silent corruption. - Use Case: When adding a new database driver to Prisma, follow this guide to implement queryRaw/executeRaw, nested transactions via savepoints, and shadow database support, then validate with the included checklist. ## Quick Start Ask the AI to implement a Prisma driver adapter for your database 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 with a connect() method returning a SqlDriverAdapter that provides queryRaw, executeRaw, executeScript, startTransaction, and dispose. Typecheck against the exact @prisma/driver-adapter-utils version installed by your target Prisma release.

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 via executeRaw, and savepoints are optional methods on the Transaction object.

Does the Prisma adapter commit() method issue SQL COMMIT?▼

No. Prisma coordinates the SQL COMMIT and ROLLBACK through executeRaw. The transaction's commit() and rollback() methods only detach listeners and release the dedicated connection exactly once, never issuing a second SQL commit or rollback.

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 P2039 carries useful details, and rethrow genuinely unexpected non-driver errors instead of fabricating GenericJs ids.

What are common mistakes when building a Prisma driver adapter?▼

Common mistakes include sharing connections across parallel transactions, keeping savepoint depth on the shared adapter, splitting migration scripts naively on semicolons, truncating 64-bit integers, and disposing caller-owned pools. The verification checklist covers each of these cases.