prisma-driver-adapter-implementation

Implement Prisma v7 driver adapters for custom database drivers.

Updated Jul 27, 2026
One-click install
npx skills add https://github.com/vasuguptadot-jpg/Life-xp- --skill prisma-driver-adapter-implementation-vasuguptadot-jpg
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/vasuguptadot-jpg/Life-xp-/tree/main/attached_assets/LifeXP-Complete/apps/api/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/vasuguptadot-jpg/Life-xp- --skill prisma-driver-adapter-implementation-vasuguptadot-jpg

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 column type conversions. This Skill provides the complete interface definitions, implementation steps, and verification checklist needed to build a working adapter for any database. ## Core Features & Use Cases - Full Interface Reference: Covers SqlDriverAdapter, Transaction, SqlQueryable, and SqlMigrationAwareDriverAdapterFactory with TypeScript definitions and ColumnTypeEnum values. - Transaction Lifecycle Protocol: Documents the critical rule that commit() and rollback() are lifecycle hooks only, with BEGIN/SAVEPOINT depth handling for nested transactions. - 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: You are building a Prisma adapter for a new database driver. Follow the four implementation steps, apply the database-specific notes, and validate against the checklist with unit and E2E tests using PrismaClient. ## Quick Start Ask the AI to implement a Prisma v7 driver adapter for your database driver following the interface contracts and checklist in this skill.

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 with startTransaction and executeScript, and a SqlMigrationAwareDriverAdapterFactory with connect and connectToShadowDb. Import all types from @prisma/driver-adapter-utils.

How do Prisma driver adapter transactions work?▼

The commit() and rollback() methods are lifecycle hooks only and must not issue SQL, because Prisma sends COMMIT and ROLLBACK via executeRaw on the transaction object. startTransaction issues BEGIN at depth one and SAVEPOINT sp_N for nested transactions.

Does the Prisma driver adapter support PostgreSQL, SQLite, and MySQL?▼

Yes, the adapter contract supports postgres, sqlite, mysql, and sqlserver providers. Each database has specific notes: SQLite only allows SERIALIZABLE isolation, PostgreSQL needs a reserved connection for transactions, and MySQL uses question-mark placeholders.

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 return raw postgres or sqlite error kinds with code and message fields.

Why does my Prisma adapter return wrong types for bigint or Date columns?▼

Row mapping must convert bigint values to strings for JSON safety and Date objects to ISO 8601 strings. On input, map string arguments to numbers or BigInt based on ArgType, and decode base64 strings to Buffer for bytes columns.