Repository navigation
feat(sql)!: remove @noCheck; a list that allows null elements is written T?[] (TML-3595) - #30741
Merged
Merged
Conversation
…ritten T?[] ADR 244 and ADR 258 drop the per-column noCheck opt-out. contract infer and the Prisma 7 reader write nullable-element lists when the database has no element check. Refs: TML-3595 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
A stored column no longer carries noCheck, and the TS field builder has
no noCheck() method. A list whose elements may be null says so with
many({ elementsNullable: true }). A stored contract that still has the
key fails validation, and the message tells the reader to re-emit the
contract from its source.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The SQL namespace no longer registers @nocheck, so writing it reports the ordinary unknown-attribute diagnostic, and the language server no longer offers it. A list whose elements may be null is written T?[]. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Prisma 7 creates no check on a list column, so the database accepts null elements. The reader now says so with elementNullable: true instead of a non-null element type plus a waived check. The client type gains | null for each element, and a Prisma 7 database still passes db verify with no migration. The Prisma 7 source journey now asserts the list column's shape. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
infer writes T[] when the live table has the derived element-not-null check and T?[] when it does not, instead of T[] @nocheck(elementNotNull). contract print no longer prints @nocheck. It still refuses a managed table that lacks a check the PSL source would derive. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Tests that built a list column with no element check waived the check on the column. They now declare that the elements may be null, which is what the database allows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
contract infer now writes T?[] for a list whose database allows null elements. The infer journeys assert that form, the enforced-check journey changes T?[] to T[] to have db update install the check, and the ORM include test stores null elements through a String?[] column. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The database allows null elements in these columns, so the contract now says so, and the client types each element as string | null. The four lines are edited to what scripts/generate-contract.ts writes for them. A full regeneration also changes unrelated lines: the generator has drifted from the committed file since earlier infer changes (date columns and foreign-key index names), and those changes are left out of this commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Stored snapshots in an old contract format are unreadable, and the recorded refusal now tells the reader to re-emit the contract for each key this version does not read. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The app and extension fragments say how to rewrite @nocheck and .noCheck(): a list that allows null elements becomes T?[] or many({ elementsNullable: true }), and a membership waiver is deleted. A Prisma 7 source now types list elements as T | null. Stored contracts that carry the key no longer load, so the fragments ship remove-nocheck.ts. It removes the key from every stored SQL contract without changing its checks, renames the snapshot directories and rewrites the migrations, refs, migration.ts and contract.d.ts that name an old storage hash. Its tests build the before and after fixtures from live framework code and run the script on them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The formatter reordered and wrapped the snapshot imports, so the generated fixtures no longer matched the committed ones. migration.ts in the fixtures now names its hashes as short string literals. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Refs: TML-3595 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…nocheck Refs: TML-3595 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The generic suffix on every unknown key is gone. A stored column that still has noCheck is refused by a dedicated check that names the first five paths, counts the rest, and says to re-emit the contract or run the upgrade script on a stored contract. Other unknown keys get the plain message again. Also rejoins doc blocks that were half re-wrapped and drops a comment that repeated the code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…mismatch Where a column's noCheck waived the element check, the script now also sets many.elementNullable to true on the storage column and on the domain field that maps it, and flips the same entries in contract.d.ts. The stored contract then says what the database enforces, and the latest snapshot equals what the rewritten source emits, so migration plan has nothing to do afterwards. A membership waiver is only deleted. A contract whose stored hash does not match its content now stops the script before it writes anything, naming the file and both hashes. The CLI ignores such a snapshot, so rehashing it would hide the problem. The fixtures are now emitted by the real emitter and their migration.ts files import the snapshots as the CLI writes them. The tests check the imports point at the renamed directories. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The app fragment now orders the steps: run the script, sign every database, then change the source and re-emit. Each entry whose re-emit changes the storage hash says to run prisma db sign, and the Prisma 7 entry no longer claims db verify passes with no other step. A new app entry tells Supabase pack users that four text[] element types become string | null and the space's hash changes, with both hashes. A journey signs a Prisma 7 database under the previous release's stored contract, then follows the fragment step by step and checks that db verify passes with no migration. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Old-format snapshots record the plain refusal again, now that the generic unknown-key suffix is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
A contract old enough to store nativeType also stores noCheck, and the nativeType rewrite comes first in the upgrade. Reporting both at once told the reader to run a script that cannot read the contract yet. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The database holds the previous release's ledger, marker and stored contracts for the remove-nocheck fixture's migrations. After following the fragment, db migrate applies nothing and db verify passes, but migration status no longer marks the two pre-upgrade migrations as applied: the script gave them new migration hashes and the ledger keeps the old ones. The test records that behaviour until it is decided. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
It no longer repeats the advice once per column, and it names the script a user can find: remove-nocheck.ts in the remove-nocheck scripts of the Prisma 8 upgrade guide. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…tions applied Refs: TML-3595 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The test came in from main, where infer printed such a column as T[] @nocheck(elementNotNull). On this branch infer writes T?[]. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Contributor
@prisma/orm-extension-arktype-json
@prisma/orm-extension-middleware-cache
@prisma/orm-extension-paradedb
@prisma/orm-extension-pgvector
@prisma/orm-extension-postgis
@prisma/orm-extension-supabase
@prisma/orm-family-mongo
@prisma/orm-family-sql
@prisma/orm-framework
@prisma/orm-mongo
@prisma/orm-postgres
@prisma/orm-sqlite
@prisma/orm-target-mongo
@prisma/orm-target-postgres
@prisma/orm-target-sqlite
@prisma/orm-toolchain
commit: |
Contributor
size-limit report 📦
|
The Prisma 7 upgrade journey lives with the published-only journeys, so it now takes the storage hash function and the Postgres serializer from @prisma/orm-postgres. The fixture generator writes migration.ts files that import @internal/postgres/migration, the workspace name of the same module, so the integration package no longer names the published root. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
wmadden
approved these changes
Oct 16, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 16, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 16, 2026
ankur-arch
added a commit
to prisma/web
that referenced
this pull request
Oct 19, 2026
* blog(orm8): enums no longer offer @nocheck(membership) Prisma ORM 8 removed @nocheck (prisma/orm#30741). An enum column always gets its CHECK constraint, so changing its values is a migration. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> * blog(orm8): scope the enum CHECK claim to managed tables, link the enums section Prisma ORM 8 generates the membership check only on tables it manages, so both enum entries now say so. The PSL link points at the Enums section, which has no @nocheck guidance. Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Ankur Datta <[email protected]>
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.
A list column that allows null elements is now written
T?[].@noCheckis gone.Before this PR, a third form existed:
tags String[] @noCheck(elementNotNull). It typedtagsasstring[]while the database accepted null elements, so a query could return a value its own type said was impossible. This PR removes@noCheck(PSL),.noCheck()(TypeScript) and thenoCheckkey on SQL storage columns. It is a breaking change, so it lands before GA.Why
@noCheckexisted, and why it can goOn a table Prisma 8 manages, the contract build adds two kinds of CHECK constraint: "no null elements" on every list column with non-null elements, and "value is a member" on every column typed by a Prisma 8 enum. Databases that Prisma 8 did not create have neither.
@noCheckwas added on 2026-08-09 so that such databases would verify, at a time when the contract had no way to say that list elements may be null. Nullable list elements landed on 2026-10-01 (#30051). From then on the honest form exists, and@noCheckonly let the type and the database disagree.What each producer writes now
schema.prismaread as the contract sourceT[]plus a waiver on every listT?[]on every list. A Prisma 7 database still needs no migration.contract inferT[] @noCheck(elementNotNull)when the database has no element checkT?[]when the database has no element check,T[]when it has onecontract print@noCheckT?[]for nullable elements@noCheck, TS.noCheck()Enums get no opt-out. An enum column on a managed table always gets its membership check. A column that should hold values outside the enum is typed by its codec instead.
A stored
contract.jsonthat still hasnoCheckis refused. The message lists the paths and says to re-emit the contract, or to run the upgrade script on a stored copy such as a migration snapshot.The Supabase pack's four
text[]columns becomeString?[]. Only those four lines of itscontract.prismachanged. Running its generator today rewrites much more, because the committed file already differs from what the generator writes onmain; that is TML-3598.Upgrading
upgrade-instructions/pending/remove-nocheck/has an entry for apps and one for extensions, and a script. Removing the key changes every stored contract's storage hash. The script therefore does what the earlier contract-rewrite scripts did: it rewrites each stored contract and snapshot, renames snapshot directories and fixes the references to them. Where a column waived its element check, the script also marks its elements nullable. A snapshot then says what the database enforces, and it matches the contract the user re-emits fromT?[], so the nextmigration planhas nothing to do. After the script, the user runsprisma db signonce, because the hash moved. Pre-upgrade migrations then show no applied mark inmigration status; see Manual QA. A test follows the instructions word for word on a database signed under the old shape, and ends withdb verifypassing.A Prisma 7 project with list columns sees its element types become
T | nulland its storage hash change. It needs no migration. A database it had already signed needsdb signagain.Docs
ADR 244 and ADR 258 are amended: generated checks cannot be waived, and element nullability alone decides the element check. ADR 258 had rejected reading element nullability from a missing check, because a check could be waived; with the waiver gone it records the opposite decision and the reason. ADR 157, ADR 249, ADR 267, the ADR index, the Data Contract and Adapters subsystem docs, the error reference and the agent skill are updated to match. The domain-enum inference project's path B depended on
@noCheck(membership); its spec now says that path must be redesigned.Verification
db signanddb verifywith no migration. Infer round trips writeString?[]without the check andString[]with it, and both verify clean. The upgrade script has 24 tests over before and after fixtures built by the real emitter.pnpm build,pnpm typecheck, lint and tests in every touched package,pnpm fixtures:check, the planner golden test,check:upgrade-coverage, and, after mergingmain, the 55 integration files that run infer, print, the Prisma 7 reader and the upgrade script.contract-tsbranch coverage is 92.86% here and 93.03% onmain, both below its 94% per-package figure. The difference is the 28 branches that only the deletednoCheckcode had.Manual QA
The branch's CLI was run against a real Postgres (PGlite) in scratch projects. All seven scenarios passed:
tags String[]andlabels String?[]gets an element check ontagsonly. The database rejects a null intagsand accepts one inlabels, and the ORM returns it.@noCheckis reported as an unsupported attribute..noCheck()does not typecheck.contract inferwritesString?[]for a hand-madetext[]column andString[]for one Prisma 8 created, and both verify.contract.jsonwithnoCheckis refused. Both fixes the message gives work.migration planreports no changes anddb verifypasses.@noCheck(membership): the next migration adds the check, fails cleanly on a non-member row, and succeeds once the row is fixed.QA also found that after the upgrade script,
migration statusstops marking the migrations applied before the upgrade. The script gives each rewritten migration a new hash, and the database's migration history keeps the old ones.db migratere-runs nothing anddb verifypasses. The rc.15 upgrade has the same gap. The upgrade instructions now say so, and TML-3601 covers fixingmigration status. Two older CLI messages QA flagged are TML-3600.Alternatives considered
String[]as non-null elements and let the first migration add the check. This would keep Prisma 7's client types. Rejected: a Prisma 7 schema must passdb verifyunder Prisma 8 with no migration.contract inferkeep writingT[]and let the next plan add the check. Rejected: infer describes the database, and that database accepts null elements.@noCheck(membership)for enums. Rejected: it has the same flaw as the list waiver. Prisma 8 adds the membership check, and a column that needs other values is not typed by the enum.noCheckkey instead of refusing it. Rejected: silently reading an old contract with a different meaning is worse than a clear refusal with a fix.Refs: TML-3595
Agent: cyrus-90
🤖 Generated with Claude Code
Summary by CodeRabbit
@noCheckor.noCheck(). Enum membership checks are always derived for managed tables.T?[]). Prisma 7 lists and affected Supabase fields use this representation.