feat(prisma): add Effect-native Prisma ORM v8 support - #1198
Merged
Merged
Conversation
Adds Prisma.Contract + Prisma.Migrate deploy-time resources, the alchemy/Prisma/ORM/Postgres runtime binding (per-execution pool, workerd-safe), /sql/prisma docs, and the cloudflare-neon-prisma example. Pinned to 8.0.0-rc.1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Install the packages built from this commit: Alchemyalchemy bun add https://pkg.ing/alchemy/838762a@alchemy.run/better-auth bun add https://pkg.ing/@alchemy.run/better-auth/838762a@alchemy.run/cloudflare-runtime bun add https://pkg.ing/@alchemy.run/cloudflare-runtime/838762a@alchemy.run/frontend-frameworks bun add https://pkg.ing/@alchemy.run/frontend-frameworks/838762a@alchemy.run/node-utils bun add https://pkg.ing/@alchemy.run/node-utils/838762a@alchemy.run/pr-package bun add https://pkg.ing/@alchemy.run/pr-package/838762a@alchemy.run/floci bun add https://pkg.ing/@alchemy.run/floci/838762aDistilled@distilled.cloud/core bun add https://pkg.ing/@distilled.cloud/core/c7b11bc@distilled.cloud/aws bun add https://pkg.ing/@distilled.cloud/aws/c7b11bc@distilled.cloud/axiom bun add https://pkg.ing/@distilled.cloud/axiom/c7b11bc@distilled.cloud/cloudflare bun add https://pkg.ing/@distilled.cloud/cloudflare/c7b11bc@distilled.cloud/hetzner bun add https://pkg.ing/@distilled.cloud/hetzner/c7b11bc@distilled.cloud/neon bun add https://pkg.ing/@distilled.cloud/neon/c7b11bc@distilled.cloud/planetscale bun add https://pkg.ing/@distilled.cloud/planetscale/c7b11bc |
Queries are now Effects: db.orm chains prisma-next's Collection via a path-replaying proxy (lazy, re-runnable, typed rows preserved through include/select), db.sql plans run through an Effect executor (execute/stream), and db.transaction commits/rolls back by exit status with a typed PrismaRollbackError. Errors surface as tagged PrismaQueryError (sqlState/constraint), PrismaConnectionError (transient), and PrismaError. No upstream changes — built entirely on prisma-next's public seams; db.use remains the escape hatch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Prisma 8's headline authoring form is the defineContract TS DSL, not PSL. The example, docs, and PR walkthrough now lead with it (PSL stays supported — the integration is authoring-agnostic). Works around an rc.1 bug where TS-authored emits write unpublished @internal/* import specifiers into contract.d.ts: Prisma.Contract rewrites them to the public @prisma/orm-postgres/* subpaths after emit (no-op for PSL), failing actionably on unmapped specifiers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Each SQL integrity violation gets its own tag (Unique/ForeignKey/ NotNull/CheckViolationError via driver-normalized SQLSTATE 23xxx), and prisma-next's structured codes split by category into PrismaOrmError / PrismaRuntimeError with an autocompleting open-union code field. Tag-per-category rather than tag-per-code: SQLSTATEs and categories are stable across RCs, individual codes churn. PrismaError remains only for truly unclassified throws. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Errors live in the Prisma namespace, so the prefix was noise: Prisma.UniqueViolationError, Prisma.QueryError, Prisma.OrmError, Prisma.RuntimeError, Prisma.ConnectionError, Prisma.RollbackError, Prisma.CliError (deploy-time), Prisma.UnknownError (fallback), Prisma.ClientError (union), Prisma.ErrorCode. Tags renamed to match (e.g. "Prisma.UniqueViolationError"). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same linguist-generated marks prisma-next init scaffolds; migration.ts stays unmarked as the placeholder editing surface. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resolves the pnpm-catalog migration (bun workspaces -> pnpm named catalogs), the Prisma Providers.ts restructure (per-resource ProviderLayer.dual replaced the dev/live implementationLayer switch), and drops the retired bun.lock. Claude-Session: https://claude.ai/code/session_01QVa7UvSQr7Y5xBqXMFbmc2
The `prisma-next` bin is retired (rc.2) and the config hard-cut landed in
rc.4: the unified `prisma` CLI mounts the ORM commands and reads only
`prisma.config.ts` in the engine envelope shape.
- `Prisma.Contract` / `Prisma.Migrate` shell `prisma contract emit`,
`prisma migration plan`, and `prisma db migrate` (was `prisma-next
migrate`), resolving the bin from the optional `prisma` peer.
- `--json` is now a newline-delimited event stream closed by a
`{ kind: "result", envelope }` document; the runner parses that
envelope and maps `envelope.error` (`code`/`summary`/`why`/`meta`,
`DRIVER.CONNECTION_FAILED`) onto `Prisma.CliError`.
- Runtime: row plans execute through `runtime().query(plan)` (rc.2 split
`query` from `execute`), transaction lanes bind `orm({ runtime: txn })`,
and ORM pagination is `.limit()` / `.offset()` (rc.7 rename).
- Config files move to `prisma.config.ts` with
`definePrismaConfig({ orm: ormConfig({ ... }) })`; fixtures, example,
and docs follow. Contract artifacts + migration packages regenerated.
- The example's `createdAt` takes the text representation
(`field.temporal.createdAtString()`): rc.6 made temporal columns decode
to `Temporal.*`, which workerd has no implementation for.
- Emitted `contract.d.ts` files are checked in (they leak unpublished
`@internal/*` specifiers the resource rewrites) so a clean checkout
typechecks without running a deploy.
Claude-Session: https://claude.ai/code/session_01QVa7UvSQr7Y5xBqXMFbmc2
The example was never listed in the root tsconfig references, so `tsc -b`
never compiled it — and it did not compile:
- `import type { Contract } from "./prisma/contract.d.ts"` resolved to the
contract *source* (`contract.ts`) next to it. Emit now writes to
`src/prisma/generated/`, matching the test fixtures.
- `field.id.uuidv7String()` types the id as a branded `Char<36>`, so an id
parsed out of a URL cannot be passed to `where({ id })`. Native uuid
columns (`field.id.uuidv7Native()` / `field.uuidNative()`) keep the TS
type a plain string.
- `prisma.config.ts` and the TypeScript-authored contract source infer
types that cannot be named portably from this project (TS2883); both are
loaded by the prisma CLI under its own toolchain, so they are excluded
the same way the test fixtures' configs are.
Claude-Session: https://claude.ai/code/session_01QVa7UvSQr7Y5xBqXMFbmc2
…lan-4f746c # Conflicts: # packages/alchemy/tsconfig.test.json # pnpm-lock.yaml
Contributor
Author
|
Automated fix: addressed CI failure in Check ( |
…lan-4f746c # Conflicts: # packages/alchemy/package.json # packages/alchemy/src/Prisma/Providers.ts # pnpm-lock.yaml # pnpm-workspace.yaml
Contributor
|
Install the packages built from this commit: alchemypnpm install https://pkg.alchemy.run/alchemy/pr:1198:745789f@alchemy.run (6)pnpm install https://pkg.alchemy.run/@alchemy.run/better-auth/pr:1198:745789fpnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare-runtime/pr:1198:745789fpnpm install https://pkg.alchemy.run/@alchemy.run/frontend-frameworks/pr:1198:745789fpnpm install https://pkg.alchemy.run/@alchemy.run/node-utils/pr:1198:745789fpnpm install https://pkg.alchemy.run/@alchemy.run/floci/pr:1198:745789fpnpm install https://pkg.alchemy.run/@alchemy.run/pkg/pr:1198:745789f@distilled.cloud (14)pnpm install https://pkg.alchemy.run/@distilled.cloud/core/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/acme/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/aws/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/axiom/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/cloudflare/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/fly-io/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/github/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/hetzner/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/neon/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/prisma/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/planetscale/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/railway/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/stripe/pr:1198:745789fpnpm install https://pkg.alchemy.run/@distilled.cloud/zerossl/pr:1198:745789fPublished |
sam-goodwin
marked this pull request as draft
September 18, 2026 03:26
sam-goodwin
marked this pull request as ready for review
September 20, 2026 00:47
…lan-4f746c # Conflicts: # pnpm-lock.yaml # website/public/llms.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Prisma ORM v8 with TypeScript-first and PSL-first contracts sharing an Effect-native Postgres query runtime. Prisma remains an optional peer.
TypeScript-first
Use Prisma's native builders without generated application imports:
PSL-first
Register
withEffecton Prisma's ORM configuration and runalchemy prisma generate(or--watch). Keepcontract.pslauthoritative and import thin generated bindings: