Skip to content

chore(deps): bump postgres-bytea to 1.0.1 to drop Buffer() deprecation - #29538

Merged
aqrln merged 1 commit into
prisma:mainfrom
kolia-zamnius:fix/bytea-buffer-deprecation
May 19, 2026
Merged

aqrln merged 1 commit into
prisma:mainfrom
kolia-zamnius:fix/bytea-buffer-deprecation

Conversation

@kolia-zamnius

@kolia-zamnius kolia-zamnius commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Reading a Bytes column through @prisma/adapter-neon, @prisma/adapter-pg, or @prisma/adapter-ppg emits Node.js DEP0005 because pg-types' BYTEA parser is [email protected], which still uses the deprecated new Buffer(...) constructor.

Fix

[email protected] (released 2025-12-17) swaps new Buffer(...) for Buffer.from || Buffer and stays inside the ~1.0.0 range that pg-types declares, so a lockfile refresh is enough — no package.json or source changes are required.

This commit updates the three pnpm-lock.yaml references (resolution block, snapshot block, and the single consumer entry under [email protected]) from 1.0.0 to 1.0.1. pnpm install --lockfile-only --frozen-lockfile round-trips cleanly.

The previous version of this PR inlined a hand-written replacement parser across the three adapters. Thanks to @aqrln for pointing out that the upstream fix had already landed and the change reduces to a transitive bump.

Refs brianc/node-postgres#2426.

@CLAassistant

CLAassistant commented May 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Centralized BYTEA text-wire decoding was added (parseBytea) and adapters (adapter-pg, adapter-ppg, adapter-neon) were updated to use it for BYTEA and BYTEA_ARRAY decoding; adapter-ppg tests were extended for BYTEA_ARRAY regressions. No public API breaking signature changes.

Changes

Centralized BYTEA parser + adapter updates

Layer / File(s) Summary
Data Shape / Utility
packages/driver-adapter-utils/src/parse-bytea.ts, packages/driver-adapter-utils/src/index.ts
Adds parseBytea(input: string): Buffer supporting \x hex and legacy backslash+octal forms and re-exports it from the package index.
Core Implementation — adapters
packages/adapter-pg/src/conversion.ts, packages/adapter-ppg/src/conversion.ts, packages/adapter-neon/src/conversion.ts
Adapters stop using pg/pg-types getTypeParser for BYTEA; convertBytes now calls parseBytea(serializedBytes) (adapter-ppg retains its non-array base64 path) and import lists were updated.
Array Normalization
packages/adapter-pg/src/conversion.ts, packages/adapter-ppg/src/conversion.ts, packages/adapter-neon/src/conversion.ts
normalizeByteaArray implementations now parse arrays with parseArray(input, parseBytea) or map elements through parseBytea, preserving NULL elements.
Tests
packages/adapter-ppg/src/conversion.test.ts
Adds BYTEA_ARRAY regression tests for \x hex elements and paired backslash+octal escape forms asserting correct Buffer decoding and NULL preservation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning The title describes a dependency bump but the changeset implements a custom BYTEA parser to replace the deprecated Buffer() constructor, not just a version bump. The PR description reveals the actual implementation replaces pg-types' deprecated BYTEA parser with a custom parseBytea implementation across three adapters. Update title to reflect this substantive code change.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description accurately describes the changeset, explaining the problem (deprecated Buffer constructor in BYTEA parsing), the fix (updating postgres-bytea and refactoring with parseBytea), and the effects across three adapters.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kolia-zamnius
kolia-zamnius marked this pull request as draft May 6, 2026 22:11
@kolia-zamnius
kolia-zamnius marked this pull request as ready for review May 6, 2026 22:11

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/adapter-pg/src/conversion.ts`:
- Around line 371-392: In parseBytea, the legacy-escape fallback (the else
branch that counts backslashes) can leave i unchanged for malformed input (e.g.,
a single trailing '\' ), causing an infinite loop; update that branch so it
always advances the index and emits a sensible character: after computing
backslashes and appending paired backslashes (using backslashes and
Math.floor(backslashes/2)), if there's an odd leftover backslash append a single
'\' (or otherwise treat it as a literal) and advance i by the total backslashes
consumed (or at minimum 1) so i always moves forward; refer to the
variables/backwards logic (backslashes, i) and the parseBytea function when
making the change.

In `@packages/adapter-ppg/src/conversion.ts`:
- Around line 445-448: Add unit tests to conversion.test.ts that exercise
normalizeByteaArray/parseByteaTextWire for real PostgreSQL wire bytea-array
forms: assert that the literal '{\\x68656c6c6f,NULL}' parses to
[Buffer.from('hello'), null]; assert that the postgres-array-unescaped octal
form '{\\\\150\\\\145\\\\154\\\\154\\\\157,NULL}' parses to
[Buffer.from('hello'), null]; assert that the empty array '{}' returns an empty
array (or null behavior consistent with existing convertBytes tests); and add a
round-trip test with non-ASCII bytes (e.g. include 0xFF in the byte sequence) to
verify Buffer.from(output, 'binary') preserves byte values. Use
normalizeByteaArray (or the same helper used by convertBytes tests) to parse the
literals and compare Buffer contents with Buffer.equals.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c3904c2b-ad0e-4df5-936d-f36d51537421

📥 Commits

Reviewing files that changed from the base of the PR and between d6d9fc9 and d135761.

📒 Files selected for processing (3)
  • packages/adapter-neon/src/conversion.ts
  • packages/adapter-pg/src/conversion.ts
  • packages/adapter-ppg/src/conversion.ts

Comment thread packages/adapter-ppg/src/conversion.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/adapter-pg/src/conversion.ts`:
- Around line 365-395: The parseBytea implementation is duplicated across
adapters; extract the logic in parseBytea (used by normalizeByteaArray and
convertBytes) into a single shared internal helper (either a new small package
under packages/ or an existing shared utils module), export it with a stable
name (e.g., parseByteaTextWire or parseBytea) and replace the local functions in
packages/adapter-pg/src/conversion.ts (parseBytea, normalizeByteaArray,
convertBytes), packages/adapter-neon/src/conversion.ts, and
packages/adapter-ppg/src/conversion.ts with imports from the shared helper;
update the callers to use the shared export and add/centralize unit tests for
hex, legacy octal, non-ASCII round-trip, and empty-array cases in the shared
helper package.

In `@packages/adapter-ppg/src/conversion.ts`:
- Around line 412-433: Rename the function parseByteaTextWire to parseBytea to
match the sibling adapters; update its declaration and all local references/call
sites that use parseByteaTextWire so they call parseBytea instead, and ensure
any exports or imports referencing parseByteaTextWire are updated accordingly;
this aligns the helper with the other adapters' parseBytea implementations (see
the existing parseBytea in the other conversion modules) and makes future
extraction into a shared utility straightforward.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 180ae13b-e5f9-479a-9a39-1f5bd6090347

📥 Commits

Reviewing files that changed from the base of the PR and between d135761 and abc4556.

📒 Files selected for processing (3)
  • packages/adapter-neon/src/conversion.ts
  • packages/adapter-pg/src/conversion.ts
  • packages/adapter-ppg/src/conversion.ts

Comment thread packages/adapter-pg/src/conversion.ts Resolved
Comment thread packages/adapter-ppg/src/conversion.ts Resolved
@kolia-zamnius

Copy link
Copy Markdown
Contributor Author

@coderabbitai thanks for the review. Pushed 063fc98 addressing the actionable findings:

Fixed:

  • Infinite loop on lone trailing backslash (legacy octal-escape branch). [email protected] carried this same defect — paired backslashes were consumed but a remainder odd one left i unmoved. The parser now advances by the full run, swallowing any odd leftover. Applied to all three adapters.
  • Renamed parseByteaTextWire → parseBytea in adapter-ppg to match the sibling adapters.
  • Added '{\\x68656c6c6f,NULL}' array test in adapter-ppg/src/conversion.test.ts exercising the hex-format BYTEA_ARRAY path.

Not addressed (with reason):

  • Extracting parseBytea into a shared helper package. Three call sites of ~25 lines each; introducing a new workspace package or shared utils module to dedupe seems heavier than the duplication itself, and the function's wire format is genuinely Postgres-specific (won't be reused by mssql / sqlite / etc.). Happy to extract if maintainers prefer that direction.
  • Docstring coverage warning (50%). The function name + the inline comment about the deprecation pin already cover the "what / why"; pure-formatting JSDoc on each branch felt like noise. Skipping unless a maintainer wants different.

Build clean across the three packages, adapter-pg (47) + adapter-ppg (26, +1 new) tests green.

@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set chat.allow_non_org_members: true in your configuration.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/adapter-neon/src/conversion.ts`:
- Around line 352-374: The else branch in parseBytea incorrectly swallows runs
of backslashes; change the handling of the "backslashes" run so you consume them
one pair at a time: count the run (backslashes), append one "\" for each pair
(i.e. '\\'.repeat(Math.floor(backslashes/2))), advance i by pairs*2, and if
there's a leftover single backslash (backslashes % 2 === 1) append that single
"\" and advance i by 1 (so it's not infinitely swallowed). Update the logic in
function parseBytea where backslashes is computed to implement this pair-by-pair
consume/append behavior.
- Line 379: The function normalizeByteaArray currently types its return as
Buffer[] but parseArray(parseBytea) can yield nulls for SQL NULL elements;
change the signature of normalizeByteaArray from returning Buffer[] to (Buffer |
null)[] and update any related exported type annotations/usages that assume
non-null elements (locate the normalizeByteaArray declaration and calls that
consume its result) so callers handle possible null entries; keep the
implementation as-is but ensure the new union return type is propagated in any
exported types or interfaces referencing normalizeByteaArray.

In `@packages/adapter-pg/src/conversion.ts`:
- Around line 365-387: The parseBytea function's backslash-run handling
incorrectly consumes an entire run at once, corrupting sequences like `\\\012`
(should produce [0x5C,0x0A]) — update the else branch inside parseBytea to
consume backslashes one pair at a time: in function parseBytea, when you hit a
backslash run, loop consuming two backslashes at a time appending one literal
'\' per pair and advancing i by 2 each iteration; if a single backslash remains,
check if the next three chars are an octal escape and parse them as before
(append parseInt(...,8) and advance by 4), otherwise treat the lone trailing
backslash as swallowed (advance by 1) — this mirrors the one-pair-at-a-time fix
applied in adapter-ppg and preserves correct output for mixed runs like
`\\\012`.
- Line 392: The return type of normalizeByteaArray is incorrect: change the
signature of normalizeByteaArray to return (Buffer | null)[] | null (instead of
Buffer[]) because parseArray can yield null for the whole array and null
elements are preserved (parseBytea isn't called for NULL elements); update the
function signature referencing normalizeByteaArray and any related type
annotations/usages so callers account for null array or null elements when
iterating.

In `@packages/adapter-ppg/src/conversion.ts`:
- Around line 412-434: In parseBytea, the else branch currently counts an entire
run of backslashes and consumes them all at once, which corrupts sequences like
"\\\012"; instead replicate the original for-loop semantics in parseBytea:
consume backslashes in pairs (emit one literal '\' per pair and advance i by 2
per pair) and leave a single trailing '\' (if any) so the octal-regex branch
(/[0-7]{3}/ check) can still match; update the logic that computes/uses
backslashes (the backslashes variable and its advancement of i) to
loop/pairwise-consume backslashes rather than swallowing the whole run at once.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c54ff901-f475-441d-9af1-d1323d1679ef

📥 Commits

Reviewing files that changed from the base of the PR and between abc4556 and 063fc98.

📒 Files selected for processing (4)
  • packages/adapter-neon/src/conversion.ts
  • packages/adapter-pg/src/conversion.ts
  • packages/adapter-ppg/src/conversion.test.ts
  • packages/adapter-ppg/src/conversion.ts

Comment thread packages/adapter-neon/src/conversion.ts Resolved
Comment thread packages/adapter-neon/src/conversion.ts Resolved
Comment thread packages/adapter-pg/src/conversion.ts Resolved
Comment thread packages/adapter-pg/src/conversion.ts Resolved
Comment thread packages/adapter-ppg/src/conversion.ts Resolved
@kolia-zamnius

Copy link
Copy Markdown
Contributor Author

Pushed bb533ad — addresses the second-round findings:

Fixed:

  • \\\012 data corruption (all 3 adapters). The previous run-counting + full-advance was wrong — a 3-backslash run consumed 3 chars instead of 2, swallowing the \ that anchors the next octal triple, so e.g. bytes [0x5C, 0x0A] (encoded as \\\012) decoded to [0x5C, 0x30, 0x31, 0x32]. Replaced with the pair-by-pair approach proposed in the comment: emit one \ per iteration, advance 2 on a paired backslash, advance 1 on a lone leftover (no stall).
  • normalizeByteaArray return type → (Buffer | null)[] in adapter-neon and adapter-pg. parseArray(input, parseBytea) passes SQL NULL elements through as null, the previous Buffer[] was lying to callers. (adapter-ppg was already correct since it had the explicit map+null-guard.)
  • Regression test added in adapter-ppg/src/conversion.test.ts covering the \\\012 case so future changes can't silently regress this path again.

Still skipping:

  • Extracting parseBytea into a shared helper. Three call sites of ~22 lines, all in Postgres-flavoured adapters. Setting up a new shared package (or routing through an existing utils one) feels heavier than the duplication, and the wire format is genuinely Postgres-specific (won't be reused by mssql / sqlite / etc.). Happy to extract if a maintainer prefers that direction — open question for review.
  • Docstring coverage 50% warning. The rest of conversion.ts in these packages is mostly normalize_* helpers without docstrings, so following local convention.

Build clean across the three packages, adapter-pg (47) + adapter-ppg (27, +1 new) tests green.

@kolia-zamnius

Copy link
Copy Markdown
Contributor Author

Pushed d371eb2 — extracted parseBytea into @prisma/driver-adapter-utils as suggested.

packages/driver-adapter-utils/src/parse-bytea.ts is the single source of truth; the three adapters now import { parseBytea } from '@prisma/driver-adapter-utils' and only carry their own thin convertBytes / normalizeByteaArray wrappers (which differ between adapters — adapter-ppg has a separate base64 path for the singleton column, the others go through parseBytea directly). All three adapters already depend on @prisma/driver-adapter-utils, so no new package wiring.

Net diff is now smaller (+63 / -26), all three adapters build clean, pnpm -r run build succeeds across the workspace, adapter-pg (47) + adapter-ppg (27) tests green.

Marking the consolidation thread as resolved from my side, but happy to revisit naming or location if there's a preferred home.

@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set chat.allow_non_org_members: true in your configuration.

@kolia-zamnius

Copy link
Copy Markdown
Contributor Author

Hi @jacek-prisma, sorry to ping — would you have a moment to give this a glance when it fits your queue? CI is also blocked on first-time-contributor approval, so it can't even run until someone with permissions kicks it off. No rush at all if there's other higher-priority work.

@kolia-zamnius

Copy link
Copy Markdown
Contributor Author

Friendly bump — branch is now up to date with main (just merged in #29553). Pinging @jacek-prisma / @aqrln in case this slipped through the queue. CI is still gated on first-time-contributor approval, so happy to wait on whoever has bandwidth to kick it off. No urgency, just keeping it visible.

@aqrln aqrln left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments.

If I'm reading this comment in the referenced issue correctly, the issue seems to be already fixed upstream and we just need to update the transitive dependency, or am I missing something?

@kolia-zamnius

Copy link
Copy Markdown
Contributor Author

You're right, and thanks for catching it. I just verified against the published tarball:

  • [email protected] was released 2025-12-17 and switches to Buffer.from || Buffer, so DEP0005 is gone.
  • It's within the ~1.0.0 range that pg-types declares, so no breaking change for consumers.
  • The only reason DEP0005 still fires for Prisma users is that the current pnpm-lock.yaml on main (as of ab2b847) still resolves postgres-bytea to 1.0.0 — a pnpm update postgres-bytea (or a pnpm.overrides entry if you want it pinned strictly) closes the gap.

Out of respect for the review time you already spent, I also pushed your two nits on parse-bytea.ts in aef173b (startsWith('\\x') + number[] instead of the intermediate string) — but the file itself is moot now, so feel free to disregard.

Happy to close this PR, or to repurpose the branch into the lockfile bump if that's more convenient — whichever fits your workflow. No urgency on my end.

@aqrln

aqrln commented May 19, 2026

Copy link
Copy Markdown
Member

I'd personally just repurpose the branch, but whichever you prefer. Ping me when the lockfile patch is ready, whether in this PR or in a new one, and I'll approve and merge. Thank you!

postgres-bytea 1.0.1 switches from `new Buffer(...)` to
`Buffer.from || Buffer`, eliminating the Node.js DEP0005 deprecation
warning that fired on every BYTEA column decoded through pg-types.

1.0.1 is within the existing `~1.0.0` range that pg-types declares,
so this is a pure lockfile refresh — no package.json or source code
changes are required.
@kolia-zamnius

Copy link
Copy Markdown
Contributor Author

@aqrln branch is repurposed and ready — the PR now contains a single commit (7ea21cb) that just bumps postgres-bytea from 1.0.0 to 1.0.1 in pnpm-lock.yaml (resolution + integrity + the single consumer ref). No package.json or source changes; pnpm install --lockfile-only --frozen-lockfile round-trips cleanly. Ready for your review whenever it fits.

@kolia-zamnius kolia-zamnius changed the title fix(adapter-neon, adapter-pg, adapter-ppg): drop deprecated Buffer() in BYTEA parser chore(deps): bump postgres-bytea to 1.0.1 to drop Buffer() deprecation May 19, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 19, 2026
@aqrln
aqrln merged commit 42f9102 into prisma:main May 19, 2026
248 of 251 checks passed
@aqrln

aqrln commented May 19, 2026

Copy link
Copy Markdown
Member

Thank you!

OIRNOIR pushed a commit to OIRNOIR/YouTube-Helper-Server that referenced this pull request Jul 28, 2026
This PR contains the following updates:

| Package | Type | Update | Change | Pending |
|---|---|---|---|---|
| [@prisma/adapter-pg](https://github.com/prisma/prisma) ([source](https://github.com/prisma/prisma/tree/HEAD/packages/adapter-pg)) | imports | minor | [`7.8.0` -> `7.9.0`](https://renovatebot.com/diffs/npm/@prisma%2fadapter-pg/7.8.0/7.9.0) | `7.9.1` |
| [@prisma/client](https://www.prisma.io) ([source](https://github.com/prisma/prisma/tree/HEAD/packages/client)) | imports | minor | [`7.8.0` -> `7.9.0`](https://renovatebot.com/diffs/npm/@prisma%2fclient/7.8.0/7.9.0) | `7.9.1` |
| [prisma](https://www.prisma.io) ([source](https://github.com/prisma/prisma/tree/HEAD/packages/cli)) | imports | minor | [`7.8.0` -> `7.9.0`](https://renovatebot.com/diffs/npm/prisma/7.8.0/7.9.0) | `7.9.1` |

---

### Release Notes

<details>
<summary>prisma/prisma (@&#8203;prisma/adapter-pg)</summary>

### [`v7.9.0`](https://github.com/prisma/prisma/releases/tag/7.9.0)

[Compare Source](prisma/orm@7.8.0...7.9.0)

Today, we are excited to share the `7.9.0` stable release 🎉

**🌟 Star this repo for notifications about new releases, bug fixes & features — or [follow us on X](https://pris.ly/x)!**

##### Highlights

##### ORM

##### Tab completions for the Prisma CLI

Typing out CLI commands from memory is now optional. Prisma ships **shell tab completions** for `bash`, `zsh`, `fish`, and PowerShell, covering commands, subcommands, options, flags, and even option values.

**Setting it up.** Most projects run Prisma through a package manager, so completions are enabled through `@bomb.sh/tab`'s package-manager integration — install it once, then source the completion for your package manager and shell:

```bash

# 1. Install @&#8203;bomb.sh/tab globally
npm install -g @&#8203;bomb.sh/tab

# 2. Wire up your package manager + shell (pnpm shown; swap in npm / yarn / bun):
echo 'source <(tab pnpm zsh)'  >> ~/.zshrc            # zsh
echo 'source <(tab pnpm bash)' >> ~/.bashrc           # bash
tab pnpm fish > ~/.config/fish/completions/pnpm.fish  # fish
tab pnpm powershell > ~/.tab-pnpm.ps1                 # PowerShell (then dot-source it from $PROFILE)
```

`@bomb.sh/tab` delegates to any locally-installed CLI that ships completions, so `pnpm prisma <TAB>`, `pnpm exec prisma <TAB>`, `yarn prisma <TAB>`, and `bun x prisma <TAB>` all complete Prisma's commands, options, and values — no per-project setup. (`npx` and `bunx` don't support completion themselves; use `npm exec` and `bun x`.)

If instead you have Prisma installed globally on your `PATH`, source its own completion directly: `source <(prisma complete zsh)` (or the `bash` / `fish` / `powershell` variant).

This is built on [`@bomb.sh/tab`](https://github.com/bombshell-dev/tab/), the same completion library that powers other CLIs in the ecosystem — including Cloudflare, Nuxt, and Vitest — so the package-manager completions you enable for Prisma work for those tools too. A wonderful community contribution from [@&#8203;AmirSa12](https://github.com/AmirSa12) ([#&#8203;28351](prisma/orm#28351)) — thank you!

<https://github.com/user-attachments/assets/1f916a60-ee4d-40be-bb7d-74035d48ca83>

##### Prisma ORM, ready for AI agents

Coding agents are now a first-class audience for Prisma, and 7.9.0 brings the first wave of work to make Prisma projects safe and productive for them to work in.

**Agent skills installed with `prisma init`** ([#&#8203;29689](prisma/orm#29689))

`prisma init` now installs the [prisma/skills](https://github.com/prisma/skills) catalog into freshly scaffolded projects. Agents such as Claude Code, Cursor, Codex, and Windsurf start out with current, version-relevant Prisma knowledge instead of relying on whatever happened to be in their training data. The install is best-effort and never blocks scaffolding; opt out at any time with `--no-skills`.

```terminal
npx prisma@latest init
```

![prisma init scaffolds a project and installs the Prisma agent skills catalog](https://github.com/user-attachments/assets/8244a6dc-cdad-4028-a652-bb5ac6e4b271)

**A safer default around destructive commands** ([#&#8203;29684](prisma/orm#29684), [#&#8203;29691](prisma/orm#29691), [#&#8203;29713](prisma/orm#29713))

Prisma's AI safety checkpoint refuses to run destructive commands when it detects that an AI agent is at the keyboard, unless the user has given explicit consent. In this release we:

- **Broadened agent detection** to cover today's landscape — Codex CLI (now on Linux as well as macOS), Qwen Code, GitHub Copilot CLI, OpenCode, Cline, Goose, Amp, Crush, Augment Code, Antigravity, Replit Agent, and Devin — plus generic `AI_AGENT` / `AGENT` conventions so future agents are caught without a code change.
- **Extended the guard to `db push --accept-data-loss`**, which previously bypassed the checkpoint even though it can drop data.
- **Removed the `migrate-reset` tool from the `prisma mcp` server** entirely — resetting a database drops it, and that is not an operation an agent should be handed as a first-class tool. An agent that needs a reset must run the CLI, where the checkpoint applies.

##### Bug Fixes

Many of the fixes below are **community contributions** — thank you to everyone who reported and fixed these!

**Prisma Client**

- Fixed a severe TypeScript performance regression introduced in Prisma 7: restoring the `OmitOpts` generic default lets `tsc` reuse cached type instantiations again, bringing type-checking on large schemas back from minutes to seconds ([#&#8203;29592](prisma/orm#29592), from [@&#8203;nfl1ryxditimo12](https://github.com/nfl1ryxditimo12)).
- The `XOR` type helper now rejects primitive values such as `data: 5`, which were previously accepted at compile time even though the runtime rejected them ([#&#8203;29735](prisma/orm#29735), from [@&#8203;kyungseopk1m](https://github.com/kyungseopk1m)).
- `$queryRaw` and `$executeRaw` now fail fast with a clear validation error when passed an invalid `Date`, instead of silently serializing it as `null` and corrupting the value sent to the database ([#&#8203;29697](prisma/orm#29697), from [@&#8203;jibin7jose](https://github.com/jibin7jose)).
- The generated client is no longer corrupted by a `///` documentation comment that contains a `*/` sequence; the comment terminator is now escaped when doc comments are emitted, in both the TypeScript and JavaScript generators ([#&#8203;29736](prisma/orm#29736), from [@&#8203;kyungseopk1m](https://github.com/kyungseopk1m)).
- Improved the runtime and TypeScript error messages shown when a driver adapter is missing from the `PrismaClient` constructor; both now include a copy-pasteable example and a link to the [driver adapters docs](https://pris.ly/d/driver-adapters) ([#&#8203;29624](prisma/orm#29624)).
- Unmapped database errors from driver adapters now surface as a user-facing `P2039` (`PrismaClientKnownRequestError`) carrying the original code and message, instead of an opaque failure, which keeps schema-drift-style problems debuggable ([#&#8203;29512](prisma/orm#29512)).
- The `prisma-client-js` generator no longer emits a stray `undefined` statement when generating from a schema that declares only enums or types and no models ([#&#8203;29738](prisma/orm#29738), from [@&#8203;kyungseopk1m](https://github.com/kyungseopk1m)).
- Fixed a connection leak when an interactive transaction times out (`maxWait`) while it is still starting: the discarded transaction now sends an explicit `ROLLBACK` before the connection is returned to the pool, instead of releasing it mid-transaction. Previously, on adapters like `@prisma/adapter-pg` and `@prisma/adapter-neon`, the next query to reuse that connection could fail with `there is already a transaction in progress` — or silently commit the leaked transaction's work ([#&#8203;29727](prisma/orm#29727), from [@&#8203;lazerg](https://github.com/lazerg)).

**CLI**

- `prisma validate` (and other schema-loading commands) no longer hangs forever on a multi-file schema whose directories contain a symlink cycle, and no longer reports the same file twice when a directory is reachable under two spellings (e.g. `/tmp` → `/private/tmp` on macOS) ([#&#8203;29740](prisma/orm#29740), from [@&#8203;kyungseopk1m](https://github.com/kyungseopk1m)).
- On Windows, engine binaries are now cached in a stable, user-level directory (`%APPDATA%\Prisma`) instead of a `cwd`-relative `node_modules\.cache`, which eliminated duplicate cache directories and the bloated Serverless/Docker bundles they caused ([#&#8203;29730](prisma/orm#29730), from [@&#8203;santichausis](https://github.com/santichausis); closes [#&#8203;22574](prisma/orm#22574), [#&#8203;6670](prisma/orm#6670), [#&#8203;11577](prisma/orm#11577)).

**Driver Adapters**

- **[@&#8203;prisma/adapter-pg](https://github.com/prisma/adapter-pg)**, **[@&#8203;prisma/adapter-neon](https://github.com/prisma/adapter-neon)**, **[@&#8203;prisma/adapter-ppg](https://github.com/prisma/adapter-ppg)**: Reading a `Bytes` column no longer emits Node.js' `DEP0005` deprecation warning, thanks to an upstream `postgres-bytea` bump ([#&#8203;29538](prisma/orm#29538), from [@&#8203;kolia-zamnius](https://github.com/kolia-zamnius)).
- **[@&#8203;prisma/adapter-ppg](https://github.com/prisma/adapter-ppg)**: `ColumnNotFound` (`P2022`) errors now parse both quoted and unquoted PostgreSQL column names, including identifiers containing spaces, matching the fix previously applied to `adapter-pg` ([#&#8203;29737](prisma/orm#29737), from [@&#8203;kyungseopk1m](https://github.com/kyungseopk1m)).
- **[@&#8203;prisma/adapter-mssql](https://github.com/prisma/adapter-mssql)**: Setting a `Bytes?` (`@db.VarBinary`) field to `null` no longer fails with an implicit-conversion error; the adapter now sends the parameter typed as `VarBinary` instead of letting SQL Server default it to `nvarchar` ([#&#8203;29630](prisma/orm#29630), from [@&#8203;AnupamKumar-1](https://github.com/AnupamKumar-1)).

**Schema Engine**

- `prisma migrate status` now reports a rolled-back migration that still exists on disk as *unapplied*, instead of incorrectly treating the schema as up to date ([prisma/prisma-engines#5817](prisma/prisma-engines#5817), from [@&#8203;goutamadwant](https://github.com/goutamadwant)).
- Primary-key constraint renames are now rendered as separate `ALTER TABLE` statements on PostgreSQL, avoiding a database error when a single table has multiple changes in one migration ([prisma/prisma-engines#4906](prisma/prisma-engines#4906), from [@&#8203;eruditmorina](https://github.com/eruditmorina)).

##### Security

- Resolved the `hono` security advisories at their source: `@prisma/dev` was updated to a version that no longer depends on `hono` at all, so the CLI is no longer exposed to those advisories through that path. We also patched moderate-severity advisories in `ajv` and `uuid` across production dependencies ([#&#8203;29514](prisma/orm#29514)).
- Hardened the Prisma Platform credentials file (`~/.config/prisma-platform/auth.json`) and its directory to `0o600` / `0o700` so OAuth tokens are no longer world-readable, bringing Prisma in line with the GitHub, AWS, and Google Cloud CLIs ([#&#8203;29568](prisma/orm#29568), from Jaeyoung Yun).
- Bumped the `openssl` crate in the schema engine binaries from 0.10.74 to 0.10.81 ([prisma/prisma-engines#5815](prisma/prisma-engines#5815)).

##### Prisma Studio

The bundled Prisma Studio moves from `0.27.3` to `0.33.0` ([#&#8203;29720](prisma/orm#29720)), gathering up everything shipped in the Studio releases in between.

##### Migrations view

Studio can now visualise your **migration history**. This view is powered by **[Prisma Next](https://www.prisma.io/docs/orm/next)** — the next major version of Prisma ORM, a full TypeScript rewrite (available now in [Early Access](https://www.prisma.io/docs/next/getting-started)) that keeps the schema-first workflow and model-first queries you know, but treats your schema as a versioned, inspectable **contract** instead of compiling it into a heavy generated client. Prisma Next records every migration and its contract snapshots in the database, and Studio reads them to draw the timeline and diff below. Databases managed with classic Prisma Migrate don't carry this ledger, so the view simply stays hidden there.

When the connected database has a Prisma Next migration ledger, a **Migrations** entry appears in the sidebar: a newest-first timeline of every applied migration with its name, apply time, operation count, and compact chips summarizing what changed (`+2 models`, `~2 models +3 fields`, `+1 model`, …). Selecting a migration opens a visual, FigJam-style diff canvas — added, removed, and changed models as colour-coded cards (`NEW` / `UPDATED` / `UNCHANGED`) with per-field before → after details, enum cards, and relation edges — next to a SQL panel of the executed statements and a Prisma-schema line diff. Switching migrations morphs the canvas rather than rebuilding it.

![The Studio Migrations view: walking a Prisma Next migration history, the diff canvas morphing between migrations](https://github.com/user-attachments/assets/2633b77a-b1d9-4c3f-b5c4-c10908f040d9)

<!-- On publishing: drag wip/demos/prisma-studio-migrations.webp into the GitHub release editor so it becomes a user-attachments URL. -->

##### Prisma Streams browser

Studio gains first-class support for Prisma Streams: a dedicated stream browser, live stream aggregations, stream diagnostics, routing-key browsing, and a WAL-history handoff straight from your tables, plus richer stream request observability with concise event-log and OpenTelemetry span summaries.

##### Working with SQL

- SQL execution, linting, and navigation are now **schema-aware**: unqualified identifiers resolve against the schema you've selected instead of always falling back to the adapter's default schema.
- SQL result visualizations are rendered with Studio-owned chart configuration, and there's an optional **Queries** view backed by query-insights snapshots.
- Added copy actions to the Query Details view.

##### Fixes

- Fixed editing PostgreSQL text-array cells when queries are compiled with inline values.
- Avoided cancelling and repeating introspection requests when Studio first mounts, removing duplicate startup work.

##### Thanks to our contributors

A heartfelt thank you to the community members whose contributions shaped this release:

[@&#8203;AmirSa12](https://github.com/AmirSa12), [@&#8203;kyungseopk1m](https://github.com/kyungseopk1m), [@&#8203;nfl1ryxditimo12](https://github.com/nfl1ryxditimo12), [@&#8203;jibin7jose](https://github.com/jibin7jose), [@&#8203;santichausis](https://github.com/santichausis), [@&#8203;kolia-zamnius](https://github.com/kolia-zamnius), [@&#8203;goutamadwant](https://github.com/goutamadwant), [@&#8203;eruditmorina](https://github.com/eruditmorina), [@&#8203;lazerg](https://github.com/lazerg), [@&#8203;AnupamKumar-1](https://github.com/AnupamKumar-1), [@&#8203;Swapanrishi](https://github.com/Swapanrishi), [@&#8203;anupamme](https://github.com/anupamme), and [@&#8203;oyi77](https://github.com/oyi77).

##### Prisma Compute is now in public beta

**"Push code, it runs."** [Prisma Compute](https://www.prisma.io/compute) — managed hosting for TypeScript apps that run right next to your database — is now available in [public beta](https://blog.prisma.io/blog/launching-prisma-compute-public-beta), and free to use while the beta lasts.

Compute deploys your app as a long-lived process on Bun, colocated with your Prisma Postgres database, so there are no cold starts, no request timeouts, and no separate hosting vendor to wire up. It's a fit for REST and GraphQL APIs, full-stack apps, streaming and gRPC, and the long-running, stateful AI agents that keep connections open and hold in-process caches — "self-hosting, without the painful parts".

- **Push-to-deploy** from the CLI or via GitHub integration. Every deployment is an immutable, versioned release with its own preview URL, and rolling back is simply promoting a previous version.
- **Branch-based environments** — each branch gets its own app and database, so you can preview a change before promoting it to production.
- **Auto-wires with Prisma Postgres** (or bring any database), with automatic health checks and self-recovery.
- **[Custom domains](https://blog.prisma.io/blog/prisma-compute-custom-domains)** — point a single CNAME at Prisma and Compute provisions and renews the TLS certificate for you, with no manual certificate uploads or private-key handling.

With Prisma ORM for type-safe data access, Prisma Postgres for the managed database, and now Prisma Compute for hosting, the whole stack lives in one place. Read the full story in the [Prisma Compute blog series](https://blog.prisma.io/blog/series/prisma-compute).

##### Enterprise support

Thousands of teams use Prisma and many of them already tap into our Enterprise & Agency Support Program for hands-on help with everything from schema integrations and performance tuning to security and compliance.

With this program you also get priority issue triage and bug fixes, expert scalability advice, and custom training so that your Prisma-powered apps stay rock-solid at any scale. Learn more or join: <https://prisma.io/enterprise>.

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNzIuMSIsInVwZGF0ZWRJblZlciI6IjQzLjI3Mi4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Server/pulls/30
lh0x00 pushed a commit to lh0x00/prisma that referenced this pull request Aug 9, 2026
prisma#29538)

## Problem

Reading a `Bytes` column through `@prisma/adapter-neon`,
`@prisma/adapter-pg`, or `@prisma/adapter-ppg` emits Node.js `DEP0005`
because `pg-types`' `BYTEA` parser is
[`[email protected]`](https://www.npmjs.com/package/postgres-bytea/v/1.0.0),
which still uses the deprecated `new Buffer(...)` constructor.

## Fix


[`[email protected]`](https://www.npmjs.com/package/postgres-bytea/v/1.0.1)
(released 2025-12-17) swaps `new Buffer(...)` for `Buffer.from ||
Buffer` and stays inside the `~1.0.0` range that `pg-types` declares, so
a lockfile refresh is enough — no `package.json` or source changes are
required.

This commit updates the three `pnpm-lock.yaml` references (resolution
block, snapshot block, and the single consumer entry under
`[email protected]`) from `1.0.0` to `1.0.1`. `pnpm install --lockfile-only
--frozen-lockfile` round-trips cleanly.

The previous version of this PR inlined a hand-written replacement
parser across the three adapters. Thanks to @aqrln for [pointing
out](prisma#29538 (comment))
that the upstream fix had already landed and the change reduces to a
transitive bump.

Refs
[`brianc/node-postgres#2426`](brianc/node-postgres#2426).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants