prisma-driver-adapter-implementation

Implements Prisma ORM v7 driver adapters for custom database drivers.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/NarixHine/uni-chem --skill prisma-driver-adapter-implementation-narixhine
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/NarixHine/uni-chem/tree/main/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/NarixHine/uni-chem --skill prisma-driver-adapter-implementation-narixhine

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 examples, 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: Defines SqlDriverAdapter, Transaction, SqlQueryable, and SqlMigrationAwareDriverAdapterFactory with TypeScript signatures and ColumnTypeEnum values. - Transaction Lifecycle Protocol: Explains that commit() and rollback() are lifecycle hooks only, with BEGIN/SAVEPOINT depth tracking handled in startTransaction. - Type Conversion & Error Mapping: Provides argument mapping (string to int/bigint, base64 to bytes), row mapping (bigint to string, Date to ISO), and driver error to MappedError conversion for Postgres, SQLite, and MySQL. - Use Case: You are building a Prisma adapter for a new database driver. Follow the step-by-step classes, run the unit and E2E test patterns, and verify against the completion checklist before shipping. ## 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 driver adapter for a custom database?▼

Implement four pieces: 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?▼

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

Does the Prisma adapter support nested transactions?▼

Yes, nested transactions use savepoints. Track transaction depth in startTransaction: issue BEGIN at depth one and SAVEPOINT sp_N for deeper levels, decrementing depth when the transaction releases.

How do I map database errors in a Prisma driver adapter?▼

Wrap driver errors in DriverAdapterError with a MappedError kind. 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?▼

Convert input arguments such as strings to int, bigint, or float and base64 strings to bytes. Convert output rows by stringifying bigint values, serializing Date objects to ISO strings, and stringifying JSON column values.

How do I test a Prisma driver adapter?▼

Write unit tests calling queryRaw, executeRaw, and startTransaction directly against the raw driver, then run E2E tests with a real PrismaClient constructed using your adapter factory to verify CRUD operations and transaction rollback behavior.