docs: add the Advanced PostgreSQL page, and fix the contract syntax rc.18 and rc.19 refuse #8574
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8574"
general
weight: 0.35
wmadden
Before, a reader who needed row-level security found the syntax under a heading on the PSL page, and an example that could not run:
A quoted string there has been refused since
8.0.0-rc.18withPSL_VALUE_TYPE_INCOMPATIBLE, the page said Prisma ORM would create theauthenticatedrole when it never does, and nothing said how the app setsapp.user_idor that the role needs aGRANT.After, one page takes the reader from the situation to a working setup:
with the
CREATE ROLE ... LOGINandGRANTthe reader runs once, theset_configcall inside a transaction, and the connection string rule.The decision
A new page, [Advanced PostgreSQL](/orm/contract-authoring/advanced-postgresql), in Contract authoring after the TypeScript builder. It is item C7 of the docs audit, which Will decided on 2026-09-28 is documented as supported with a Limitations section; the spec is
docs/orm-docs-audit/slices/08-advanced-postgresql/spec.mdon the audit branch. Each section opens with the situation, then the contract for it, then whatmigration plananddb verifydo with it, then the link to the reference entry: rows that belong to a user, an index on an expression or on some rows, a value the database must reject, a table Prisma ORM should not touch, an extension a migration needs, and adopting these from an existing database.The Limitations section lists only what an Opus agent confirmed against prisma/orm at
v8.0.0-rc.19, with the open issue for each and what to do instead. Of the eight gaps recorded on 2026-09-28, four still hold (noGRANT, noFORCE ROW LEVEL SECURITY, the@@indexsort-order failure, constraints dropped from single-table variants), one was fixed in rc.13 (policy ordering), one is narrower than recorded (drift only for SQL you typed withmap:), one is wider (contract inferreads onlypublic, not only policies across schemas), and one had no source and is dropped (@@controlon external tables with relations).@noCheckturns out to be removed entirely in rc.19, not only its enum form.Stale syntax fixed on the way
sql...literal. The PSL page and the TypeScript builder page showed quoted strings in twelve places (@@index,@@check, policyusingandwithCheck, and the builder'sconstraints.index,check,policySelect,policyUpdate). All twelve now use the literal, the builder examples importsql, and the prose says a quoted string is refused.and@default(cuid())are refused withPSL_GENERATOR_IN_DEFAULTin a Prisma ORM 8 contract. The Auth.js, Permit.io, and Shopify guides are Prisma ORM 7 guides, so they keep@default(...); an earlier commit on this branch changed them and a later one put them back.block makes Prisma ORM create the role. At rc.19 a role is referenced, never created, anddb verifyfails when it is missing; the page says so now.How it was checked
The reader-review skill's three scripts and cspell pass on every changed page; lint:links
andlint:versionspass. Two cold reader rounds with the Prisma ORM 7 reader persona on the new page, a limitations check against rc.19, and a fact re-check of every claim and example againstv8.0.0-rc.19.What a reviewer should know
example runs throughtx.querywith.returnsRow({ set_config: "pg/text@1" }), becauseset_configreturns a row. The checker confirmed the raw query shape against the raw-queries page and the runtime.writesCREATE POLICYbut neverCREATE ROLEorGRANT; the page shows arawSqlstep withoperationClass: 'widening'for theGRANT.Alternatives considered
Agent: seacole-52
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Documentation
Added guidance for advanced PostgreSQL features in Prisma ORM contracts, including row-level security, indexes, constraints, extensions, and existing database objects.
Clarified migration and verification workflows, role management requirements, and current limitations.
Updated related pages with links and clarifications about roles, index arguments, and type handling.
* Clarified that migration new
starts from thedbref when migrations exist, rejects unchanged contracts, and supports creating SQL- or data-only migrations with--from`.<!-- end of auto-generated comment: release notes by coderabbit.ai -->