prisma-driver-adapter-implementation

Implements Prisma ORM v7 driver adapters for custom database drivers.

Updated Jul 21, 2026
One-click install
npx skills add https://github.com/8ReTid8/vitural_reality_test --skill prisma-driver-adapter-implementation-8retid8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/8ReTid8/vitural_reality_test/tree/main/my-app/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/8ReTid8/vitural_reality_test --skill prisma-driver-adapter-implementation-8retid8

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Implementing a Prisma v7 driver adapter requires contract details that cannot be inferred from existing code, such as the transaction lifecycle protocol, error mapping rules, and type conversion requirements. This Skill provides the complete specification so an adapter works correctly with PrismaClient on the first attempt. ## Core Features & Use Cases - Full Interface Reference: Covers SqlDriverAdapter, Transaction, SqlQueryable, and SqlMigrationAwareDriverAdapterFactory with TypeScript definitions and implementation steps. - Transaction Lifecycle Protocol: Documents the critical rule that commit() and rollback() are lifecycle hooks only, with BEGIN/SAVEPOINT handling for nested transactions. - Type and Error Mapping: Provides argument mapping, row mapping, column type inference, and driver error conversion to MappedError for PostgreSQL, SQLite, and MySQL. - Use Case: You are building a Prisma adapter for a new database driver. Follow the step-by-step classes, conversion helpers, and verification checklist, then validate with the included unit and E2E test strategies. ## Quick Start Ask the AI to implement a Prisma v7 driver adapter for your database driver using this guide, including the factory, adapter, and transaction classes.

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 v7 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.

Why should commit() and rollback() not execute SQL in a Prisma adapter?

Prisma sends COMMIT and ROLLBACK statements itself via executeRaw on the transaction object. The commit and rollback methods are lifecycle hooks only, responsible for releasing the connection or resources, not issuing SQL.

How does Prisma handle nested transactions in driver adapters?

Track transaction depth in the adapter. Depth one issues BEGIN with an optional isolation level, while deeper levels issue SAVEPOINT sp_N. Decrement the depth counter in the transaction release callback.

What type conversions does a Prisma driver adapter require?

Map string arguments to int, float, or bigint and base64 strings to bytes on input. On output, convert bigint to string, Date to ISO 8601 strings, and JSON objects to stringified form, aligning column metadata with ColumnTypeEnum values.

How do I map database errors for Prisma driver adapters?

Wrap all driver errors in DriverAdapterError with a MappedError kind. Map database-specific codes such as PostgreSQL 23505 to UniqueConstraintViolation, or use the postgres and sqlite error kinds with code and message fields.

Which isolation levels are supported by Prisma driver adapters?

PostgreSQL and MySQL support READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, and SERIALIZABLE. SQLite only supports SERIALIZABLE. Invalid levels must throw a DriverAdapterError with the InvalidIsolationLevel kind.