◐ Shell
clean mode source ↗

feat: Migrate Prisma from 6.14.0 to 7.7.0 with driver adapters by devin-ai-integration[bot] · Pull Request #3391 · triggerdotdev/trigger.dev

- Bump prisma, @prisma/client to 7.7.0, add @prisma/adapter-pg
- Switch to engine-less client (engineType = 'client') with PrismaPg adapter
- Remove binaryTargets and metrics preview feature from schema.prisma
- Remove url/directUrl from datasource block (Prisma 7 requirement)
- Create prisma.config.ts for CLI tools (migrations)
- Rewrite db.server.ts to use PrismaPg adapter for writer + replica clients
- Drop $metrics: remove from metrics.ts, delete configurePrismaMetrics from tracer.server.ts
- Update PrismaClientKnownRequestError import path (runtime/library -> runtime/client)
- Update all PrismaClient instantiation sites to use adapter pattern:
  testcontainers, tests/utils.ts, scripts, benchmark producer
- Exclude prisma.config.ts from TypeScript build

Co-Authored-By: Eric Allam <eallam@icloud.com>
- Bump @prisma/instrumentation from ^6.14.0 to ^7.7.0 for Prisma 7 compatibility
- Fix DATABASE_POOL_TIMEOUT incorrectly mapped to idleTimeoutMillis (semantic mismatch)
  - pool_timeout was a connection acquisition timeout, idleTimeoutMillis is idle eviction
  - Use DATABASE_CONNECTION_TIMEOUT for idleTimeoutMillis instead (pg Pool has no
    direct acquisition timeout equivalent)

Co-Authored-By: Eric Allam <eallam@icloud.com>
The references/prisma-7 project had @prisma/client@6.20.0-integration-next.8
which caused @prisma/client-runtime-utils@6.20.0 to be hoisted to root
instead of @7.7.0 needed by the generated Prisma 7 client. This caused
TypeError: isObjectEnumValue is not a function at runtime.

Co-Authored-By: Eric Allam <eallam@icloud.com>
…ma 7)

Prisma 7 removed the --skip-generate flag from 'prisma db push'. This caused
the testcontainers migration command to fail silently (tinyexec swallows the
error), resulting in empty databases and 'table does not exist' errors in tests.

Also added --url flag to pass the connection string directly to the CLI,
ensuring the correct URL is used regardless of config file resolution.

Co-Authored-By: Eric Allam <eallam@icloud.com>
… binary copy)

Co-Authored-By: Eric Allam <eallam@icloud.com>
With Prisma 7's PrismaPg driver adapter, write conflicts (PostgreSQL 40001)
surface as DriverAdapterError with message 'TransactionWriteConflict' instead
of PrismaClientKnownRequestError with code P2034. Without this fix, the
$transaction retry logic silently stops retrying on serialization failures.

Added isDriverAdapterTransactionWriteConflict() check to isPrismaRetriableError()
and updated $transaction catch block to use the unified retriable check.

Co-Authored-By: Eric Allam <eallam@icloud.com>
With Prisma 7's PrismaPg driver adapter, each query goes through the pg
Pool + adapter layer, adding ~5-10ms overhead per query vs the old
in-process Rust engine. The continueRunIfUnblocked worker job executes
5+ DB queries, so the previous 200ms window was too tight for CI runners.

- Increase setTimeout from 200ms to 1000ms for all completeWaitpoint ->
  continueRunIfUnblocked wait patterns
- Increase idempotencyKeyExpiresAt from 200ms to 60s to prevent expiry
  during test execution
- Increase getSnapshotsSince pre-complete wait from 200ms to 500ms

Co-Authored-By: Eric Allam <eallam@icloud.com>
…t race condition

With PrismaPg adapter overhead, each trigger() call takes longer than with
the old Rust engine. A 50ms processWorkerQueueDebounceMs causes the background
processQueueForWorkerQueue job to fire between individual triggers, moving
items to the worker queue one-by-one in arrival (FIFO) order instead of
waiting for all items to be in the master queue and moving them collectively
in priority order.

Increase to 10s so the test's manual processMasterQueueForEnvironment call
controls the ordering.

Co-Authored-By: Eric Allam <eallam@icloud.com>
Add deterministic prepared statement names (SHA-256 hash of SQL) to both
writer and replica PrismaPg adapters. This lets PostgreSQL reuse cached
query plans instead of parsing and planning every query from scratch.

The old Rust engine did this automatically; the driver adapter requires
explicit opt-in via the statementNameGenerator option (added in v7.6.0).

Co-Authored-By: Eric Allam <eallam@icloud.com>

devin-ai-integration[bot]

@d-cs d-cs mentioned this pull request

Jun 15, 2026

6 tasks