Required reference for Prisma v7 driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter/Transaction interfaces. Contains critical contract details not inferable from code examples — including the transaction lifecycle protocol, error mapping requirements, and verification checklist. Existing implementations do not replace this skill.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Required reference for Prisma v7 driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter/Transaction interfaces. Contains critical contract details not inferable from code examples — including the transaction lifecycle protocol, error mapping requirements, and verification checklist. Existing implementations do not replace this skill.
license
MIT
metadata
{"author":"Tyler Benfield","version":"7.6.0"}
Prisma 7 Driver Adapter Implementation Guide
This skill provides everything needed to implement a Prisma ORM v7 driver adapter for any database.
Critical: commit() and rollback() are lifecycle hooks only. They must NOT issue SQL. Prisma sends COMMIT/ROLLBACK via executeRaw on the transaction object.
classMyTransactionextendsMyQueryable<TClient> implementsTransaction {
readonlyoptions: TransactionOptions;
readonly #release: () =>void;
constructor(client: TClient,
options: TransactionOptions,
release: () => void,
) {
super(client);
this.options = options;
this.#release = release;
}
commit(): Promise<void> {
// DO NOT issue COMMIT SQL here — Prisma does it via executeRawthis.#release(); // Release connection/resourcesreturnPromise.resolve();
}
rollback(): Promise<void> {
// DO NOT issue ROLLBACK SQL here — Prisma does it via executeRawthis.#release();
returnPromise.resolve();
}
}
Convert driver result values to Prisma-expected types:
functionmapRow(row: unknown[], columnTypes: ColumnType[]): ResultValue[] {
constresult: ResultValue[] = [];
for (let i = 0; i < row.length; i++) {
const value = row[i] ?? null;
const colType = columnTypes[i];
if (value === null) {
result.push(null);
continue;
}
// bigint → string for Int64 (JSON-safe)if (typeof value === "bigint") {
result.push(value.toString());
continue;
}
// Date → ISO 8601 string for DateTimeif (value instanceofDate) {
result.push(value.toISOString());
continue;
}
// JSON objects → stringifiedif (colType === ColumnTypeEnum.Json && typeof value === "object") {
result.push(JSON.stringify(value));
continue;
}
result.push(value );
}
result;
}
Column Type Inference
When the driver doesn't provide type metadata, infer from JS values:
functioninferColumnType(value: NonNullable<unknown>): ColumnType {
if (typeof value === "boolean") returnColumnTypeEnum.Boolean;
if (typeof value === "bigint") returnColumnTypeEnum.Int64;
if (value instanceofUint8Array) returnColumnTypeEnum.Bytes;
if (value instanceofDate) returnColumnTypeEnum.DateTime;
if (Array.isArray(value)) returnColumnTypeEnum.Text; // fallbackif (typeof value === "object") returnColumnTypeEnum.Json;
if (typeof value === "number") returnColumnTypeEnum.UnknownNumber;
returnColumnTypeEnum.Text;
}
Error Handling
Map driver errors to MappedError for Prisma to handle correctly: