prisma-driver-adapter-implementation

Implements Prisma v7 driver adapters for custom database drivers.

1|Updated Jun 18, 2026
One-click install
npx skills add https://github.com/Sima-Malla/Digital_Menu --skill prisma-driver-adapter-implementation-sima-malla
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/Sima-Malla/Digital_Menu/tree/main/my-app/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/Sima-Malla/Digital_Menu --skill prisma-driver-adapter-implementation-sima-malla

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Implementing a Prisma ORM v7 driver adapter requires contract details that cannot be inferred from existing code examples, such as the transaction lifecycle protocol, error mapping rules, and type conversion requirements. This Skill provides the complete specification so your adapter works correctly with PrismaClient. ## Core Features & Use Cases - Full Interface Reference: Covers SqlDriverAdapter, Transaction, SqlMigrationAwareDriverAdapterFactory, SqlQuery, SqlResultSet, and ColumnTypeEnum with TypeScript definitions. - Transaction Protocol Guidance: Explains that commit() and rollback() are lifecycle hooks only, with BEGIN/SAVEPOINT depth tracking for nested transactions. - Error and Type Mapping: Shows how to convert driver errors into MappedError kinds and map arguments, rows, and column types between Prisma and the database driver. - Use Case: You are building a Prisma adapter for a new PostgreSQL-compatible database. Follow the step-by-step classes, conversion helpers, and verification checklist to produce a working adapter validated by unit and E2E tests. ## Quick Start Ask the AI to implement a Prisma v7 driver adapter for your database driver following this skill's interface contracts and checklist.

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 custom database?

Implement four layers: a SqlQueryable base class with queryRaw and executeRaw, a Transaction class with commit and rollback hooks, a SqlDriverAdapter adding executeScript and startTransaction, and a SqlMigrationAwareDriverAdapterFactory exposing connect and connectToShadowDb.

How do Prisma adapter transactions handle commit and rollback?

The commit() and rollback() methods are lifecycle hooks only and must not issue SQL. Prisma sends COMMIT and ROLLBACK statements via executeRaw on the transaction object, so your hooks should only release the connection or resources.

Does the Prisma driver adapter support nested transactions?

Yes, nested transactions are handled with savepoints. Track transaction depth in the adapter, issue BEGIN at depth one, and issue SAVEPOINT sp_N for deeper levels, decrementing depth when each transaction releases.

How do I map database errors to Prisma error types?

Convert driver errors into MappedError objects wrapped in DriverAdapterError. Map database-specific codes, such as PostgreSQL 23505 to UniqueConstraintViolation or 23503 to ForeignKeyConstraintViolation, and fall back to GenericJs for unknown errors.

What type conversions does a Prisma adapter need?

Map string arguments to int, float, or bigint based on ArgType, and convert base64 strings to bytes. On output, convert bigint values to strings, Date objects to ISO 8601 strings, and JSON objects to stringified form for Prisma compatibility.

Why does my Prisma adapter fail with connection poolers like PgBouncer?

Connection poolers in transaction mode break prepared statements and session state. Set prepare: false for PostgreSQL drivers and use a dedicated reserved connection for transactions so BEGIN and COMMIT run on the same connection.