Repository navigation
docs(sql): add cross-provider guides and Aurora examples - #1737
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>
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
…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:1737:c03d137@alchemy.run (6)pnpm install https://pkg.alchemy.run/@alchemy.run/better-auth/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare-runtime/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@alchemy.run/frontend-frameworks/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@alchemy.run/node-utils/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@alchemy.run/floci/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@alchemy.run/pkg/pr:1737:c03d137@distilled.cloud (14)pnpm install https://pkg.alchemy.run/@distilled.cloud/core/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/acme/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/aws/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/axiom/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/cloudflare/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/fly-io/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/github/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/hetzner/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/neon/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/prisma/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/planetscale/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/railway/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/stripe/pr:1737:c03d137pnpm install https://pkg.alchemy.run/@distilled.cloud/zerossl/pr:1737:c03d137Published |
…covery # 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 cross-provider SQL guides and runnable Drizzle examples for Aurora PostgreSQL and Aurora DSQL.