prisma-driver-adapter-implementation

Implements Prisma ORM v7 driver adapters for custom database drivers.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/ArvindIyer1/prediction-market-project --skill prisma-driver-adapter-implementation-arvindiyer1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/ArvindIyer1/prediction-market-project/tree/main/packages/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/ArvindIyer1/prediction-market-project --skill prisma-driver-adapter-implementation-arvindiyer1

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: Covers SqlDriverAdapter, Transaction, SqlQueryable, and SqlMigrationAwareDriverAdapterFactory with TypeScript definitions and ColumnTypeEnum values. - Step-by-Step Implementation: Guides creation of the queryable base class, transaction class, adapter class, and factory class, including nested transaction savepoint handling. - Conversion and Error Mapping: Provides argument mapping, row mapping, column type inference, and driver error to MappedError conversion for PostgreSQL, SQLite, and MySQL. - Use Case: A developer building a Prisma adapter for a new database driver uses this Skill to implement startTransaction with correct BEGIN/SAVEPOINT semantics, wrap errors in DriverAdapterError, and validate the result against the included checklist and E2E test strategy. ## Quick Start Ask the AI to implement a Prisma v7 driver adapter for your database driver using 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 classes: a SqlQueryable base with queryRaw and executeRaw, a Transaction class with commit and rollback lifecycle 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 themselves. Prisma sends COMMIT and ROLLBACK statements via executeRaw on the transaction object, so the hooks only release the connection or resources.

Does the Prisma driver adapter support nested transactions?

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

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

Convert driver errors into MappedError objects and wrap them in DriverAdapterError. Map database-specific codes such as PostgreSQL 23505 to UniqueConstraintViolation, or use the postgres and sqlite error kinds with the raw code and message.

What type conversions does a Prisma adapter need?

Convert string arguments to int, float, or bigint based on ArgType, and 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.