Repository navigation
fix(mongo): read unmodified Prisma 6 schemas with Prisma 6's storage and types, and correct the rc.13 upgrade guide - #30521
Conversation
A Prisma 6 schema may index a field of a composite type with `@@index([address.city])`. The shared parser read only `a` or `a.b(` in that position, so the bare form failed with PSL_INVALID_MODEL_MEMBER before the Prisma 6 reader could report its own diagnostic, and a call on a deeper path such as `address.geo.lat(sort: Desc)` failed too. A dotted chain in expression position now parses as a `PathExpr` node (`PathExprAst.path()`), and a call whose callee has more than one dot keeps that path as its callee. The Prisma 6 reader reports PSL.PRISMA6_MONGO_COMPOSITE_INDEX_PATH_UNSUPPORTED for every form, and `contract format` formats such a schema instead of refusing it. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
With dotted paths now parsed, `@@index([address.city])` in a Prisma 8 Mongo schema reached the attribute spec and failed with a generic "Expected one of: field name | wildcard() | ..." listing. The Mongo interpreter now reports PSL_INVALID_INDEX naming the path and saying that indexes on fields of a composite type are not supported yet, for the bare path, the call form and deeper paths. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Prisma 6 MongoDB source told users to remove an unsupported `@default(...)` or `onDelete`, but the schema it reads is the one the running Prisma 6 app uses. On Prisma 6 the client fills defaults and emulates referential actions, so removing them changes that app: a required field must then be passed to every create call, and cascades stop. Every diagnostic whose fix edits the Prisma 6 schema now says what the edit does to the Prisma 6 app, as the Unsupported message already did: defaults (required, optional and composite-type fields), onDelete and onUpdate, optional generated fields, @updatedat on other types, native types, list relations, views, non-ObjectId ids (stored _id values keep their type), and composite index paths. Literal defaults stay refused. MongoDB has no stored defaults, and the contract has execution defaults only for generators; filling a literal on create would need a new runtime generator. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…provider `contract emit` on a Prisma 6 schema listed findings in the order the reader visited constructs, so a view at the end of the file printed first. A PostgreSQL schema got PSL.PRISMA6_MONGO_PROVIDER_MISMATCH and then an id finding for every model, and a mistyped schema path printed a raw ENOENT error. Findings are now sorted by file and position. A provider mismatch is reported alone (with any parse errors), since nothing else about a schema for another database is useful. A path with nothing at it says so and names prisma6Schema() in prisma.config.ts as the place to fix it. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
When `db verify` found a storage-hash mismatch it said "Migrate database or re-sign if intentional", and when `db sign` refused it said to run `db update`. For a project whose database another tool migrates, that advice is wrong: Prisma 8 must not migrate that database. A contract source may now declare `schemaOwner.applySchemaChange`, the step in the owning tool that applies a schema change. When it is set, the storage-hash mismatch and schema drift findings of `db verify` and the refusal of `db sign` point at that step and then at `db sign`. The framework only carries the text; the source that knows the tool writes it. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…database is behind A project that reads its Prisma 6 schema through `prisma6Schema`, or its Prisma 7 schema through `prisma7Schema`, keeps the earlier version in charge of the database. After a schema change `db verify` told such a user to migrate the database and `db sign` told them to run `db update`, which would have Prisma 8 change a database it does not own. Both sources now declare the earlier version as the schema owner, so the advice is Prisma 6 `db push` (or Prisma 7 migrations) followed by `db sign`. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Init set "type": "module" in any package.json without a type, so that the scaffolded db.ts, which imports the contract with an ESM-only import attribute, loads. In an existing app that changes how every .js file loads and can break a CommonJS app, such as a Prisma 6 project. Init now sets the type only in a package.json it creates or one that declares no dependencies yet. An existing project that declares dependencies keeps its module type, and init warns that db.ts loads only as an ES module. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Schema setup In a project whose schema.prisma says provider = "mongodb", orm init called it a Prisma 7 project and suggested --from-prisma7-schema, which then failed with CLI.INIT_PRISMA7_SOURCE_UNAVAILABLE. Nothing mentioned prisma6Schema, and a starter run took the prisma package name and prisma.config.ts from the Prisma 6 CLI the app still needs. Prisma 7 has no MongoDB support, so such a schema is a Prisma 6 schema. Init now stops with CLI.INIT_PRISMA6_SCHEMA_FOUND before asking, installing or writing anything, and never suggests the Prisma 7 path. Its next actions are the side-by-side setup, with the files to write: the Prisma 6 CLI moves to an npm alias run through a prisma6 script with its own prisma6.config.ts, Prisma 8 is installed, and prisma.config.ts reads the schema through prisma6Schema. A run with --target and --authoring still scaffolds a starter project, and now warns what that does to the Prisma 6 CLI. `orm init --help` describes both. Closes #30473 Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
… code changes The Mongo package README asked for a package.json that depends on `prisma` "the Prisma 8 CLI" while Prisma 6 keeps running `prisma db push`; one package name cannot resolve to both. It also never said that `db sign` writes a ref and a contract snapshot into the project, or how Prisma 8 reads the same documents differently. The README now documents a setup that was run end to end (pnpm 10.27, Prisma 6.19.3, Prisma 8.0.0-rc.18, a MongoDB replica set): Prisma 8 keeps the `prisma` name, Prisma 6 is installed under an npm alias and run through a `prisma6` script with its own prisma6.config.ts, because the alias installs no binary and the Prisma 6 CLI reads prisma.config.ts; both configs import dotenv/config; mongodb 7 is declared as the peer it is. It describes `migrations/app/refs/db.json`, the snapshot and `--no-advance-ref`, and lists what changes for Prisma 6 application code: `_id`, collection-named models, stored enum values, optional fields that read as absent, Bytes, BigInt, Decimal and Json. The reader's README summarises the same points. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every emitted contract.d.ts imported each helper type the stack declares next to its CodecTypes: every Mongo contract imported `Vector`, and every Postgres contract imported Char, Varchar, Numeric, Timestamp and the rest, whether or not a field used them. The emitter now writes the body first and imports a declared type only when the body names it. The committed contract.d.ts files and migration snapshots are regenerated with `pnpm fixtures:emit`; only their import lines change. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The examples' contract.d.ts files changed only in their import lines. An app needs no change: its committed contract.d.ts keeps working, and the next `contract emit` drops the unused imports. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ange The stacked PRs that added Mongo Int64, Decimal128, Binary, Json and Bson each wrote their upgrade fragment against the previous PR, and all of them shipped in rc.13. The published guide therefore told rc.12 users that their Mongo Json fields changed meaning, validator and storage hash, and that variant Int64, Decimal128, Binary, Json and Bson fields and Prisma 6 contracts behaved differently. rc.12 had none of these: it refused Json, and its Mongo codecs were ObjectId, String, Double, Int32, Bool, Date and Vector. Each entry the project wrote was checked against v8.0.0-rc.12 (its sources and published exports). The app guide drops mongo-json-field-semantics, and mongo-variant-field-codecs keeps only the ObjectId change, including the $toObjectId fix for TypeScript builder contracts, which had no validator in rc.12. The extension entry mongo-bson-codec-added lists the five codecs that are new rather than describing a change to mongo/json@1. The rc.13 release notes lose the matching breaking-change bullet and link the corrected guides. Published guides are corrected in place through a normal PR, as upgrade-instructions/README.md allows; the archived fragments under releases/ stay as they were submitted. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
… in a Json field The query lived only in the rc.12 to rc.13 app guide, which no longer carries the Json entry, and its archived source missed a Date or ObjectId that is a direct element of an array. The reference now holds the five-clause query the published guide had, with the $elemMatch clause for direct array elements, and says exactly what it misses: values nested inside an object, an array of objects or an array of arrays. Checked against MongoDB with one document per case. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h internal one Several entries named only @internal/* specifiers, which an extension author outside this repository cannot import: the codec types and BSON value types, the contract types, the Mongo control adapter and driver, the psl-printer, psl-infer and relational-core subpaths. Each now also names the @prisma/orm-* path that re-exports it (checked against the generated re-exports of the public packages), the Mongo runner snippet uses the published imports, and mongo-field-builder-execution-defaults-parameter shows where ContractFieldType, ExecutionMutationDefaultPhases, FieldBuilder and EnumTypeHandle are imported from. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The detection for mongo-psl-scalar-names (Int, Float, Boolean, DateTime) matched a Prisma 6 schema.prisma kept beside the Prisma 8 contract, and its only guard, "a schema whose prisma.config.ts uses @prisma/orm-mongo", holds in exactly such a project. Renaming there breaks Prisma 6, which has no Int32, Double, Bool or Date. The detection now skips any file that declares provider = "mongodb", which every Prisma 6 MongoDB schema does and no Prisma 8 schema in the repository does, and the guide limits the rename to the Prisma 8 contract source and its migration copies, naming Prisma 6 schemas and the other files of a multi-file Prisma 6 schema as excluded. On the QA side-by-side project the Prisma 6 schema drops out of the hits while src/contract.prisma and its three migration copies stay. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bCheck mongo-codec-subpaths-move-to-target said emitted contract.d.ts files that still import adapter/codec-types "no longer compile". With skipLibCheck: true, which the tsconfig from prisma orm init sets, tsc reports nothing for a declaration file: the import fails silently, the contract field types stop resolving, and the errors show up where the contract is used. The entry now describes that and says to rewrite or re-emit every file the detection finds whether or not tsc complains. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
A detection glob such as **/*.{ts,mts,cts} also matched build output
(an extension's dist/index.d.mts, for example) and node_modules, and
the guide format has no way to exclude paths. upgrade-app.md and
upgrade-extension.md now say to skip node_modules and the directories
the build writes, and to keep committed migration snapshots.
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ORM fills a temporal.* preset field only when it writes, so after the field is added, documents written before it read the field as undefined although it is typed Date, and with a PSL contract every update to them fails collection validation. The Mongo subsystem doc now gives a backfill next to the presets: one updateMany that sets every added preset field (createdAt from the ObjectId _id timestamp, updatedAt from $$NOW), because a document still missing one of them fails the new validator. Run against MongoDB with the validator in place. The scalar types reference points to it. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
main changed the db sign and db verify drift advice to offer db update or a contract change. A contract source that names a schema owner keeps its own advice ahead of that. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Semantic tokens treated every expression that was not a literal, call, array, object or tagged literal as an identifier, so the new PathExpr node from `@@index([address.city])` reached `identifier.name()` and threw. A member path is now tokenised as one property per segment, and so is the callee of a call on a deeper path such as `address.geo.lat(sort: Desc)`, read through the new FunctionCallAst.memberPath() getter. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The extensions' contract.d.ts files changed only in their import lines, and the Mongo package README gained documentation. An extension needs no change: a committed contract.d.ts keeps working, and the optional schemaOwner field on contract sources is new surface nothing has to set. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o fix it prisma7Schema printed the raw Node ENOENT error for a path with nothing at it, and the error reference already claimed otherwise (naming prisma6Schema). The Prisma 7 source now says there is no file or directory at the path and to fix the path passed to prisma7Schema() in prisma.config.ts, as the Prisma 6 source does, and the error reference names the right function. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the guides say so The scalar-rename pattern skipped a Prisma 6 schema only when run as a JavaScript regex over the whole file without flags. With the m flag its ^ matched at every line, so the file-level exclusion failed, and a line-by-line tool (grep -P, rg -P) cannot see the rest of the file at all. The guides only said "glob + content predicate", and other patterns already span lines. upgrade-app.md and upgrade-extension.md now state how a detection block runs: each matches entry is new RegExp(pattern), no flags, tested against a whole file; contains entries are substrings; a line-by-line search is not the same test, and rg -U --pcre2 is. The scalar-rename pattern anchors its exclusion with (?<![\s\S]), which holds with any flags. Checked with Node (no flags, g, m, gm) and rg -U --pcre2 on the QA side-by-side project: the Prisma 6 schema is skipped and the four Prisma 8 files are hits, and every other app and extension pattern gives the same hits in both engines. The authoring skill says the same. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hout it The message said only that the Prisma 6 client "falls back to its default action for this relation". Checked with the Prisma 6.19.3 client on MongoDB: without onDelete, deleting a parent that still has children on a required relation fails with P2014 (Restrict), on an optional relation the children's key is set to null (SetNull), and onUpdate defaults to Cascade. The message now names the default the client applies instead and what it does to that relation (for example "deleting a User that still has Post documents fails with P2014"), or says the Prisma 6 app is unchanged when the argument already names the default. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…isma 6 app The native type message said "if @db.Long is not the default BSON type for Int, removing it also changes the Prisma 6 app", though the reader knows both types. It now states the case, from what Prisma 6.19 stores (checked by writing every native type through the Prisma 6 client): @db.Long on Int, @db.String on String and @db.Date on DateTime change nothing, because Prisma 6 stores those types anyway (a plain Int is a BSON long); @db.Int or @db.Timestamp mean new values are stored as long or date while stored documents keep int or timestamp; a native type Prisma 6 itself rejects on that field type is named as such. The same applies to @db.ObjectId on Bytes and on types Prisma 6 rejects. IGNORED_FIELD_REFERENCED now says that removing @ignore adds the field to the Prisma 6 client, that removing an index makes Prisma 6 db push drop it (checked), and that removing a relation field removes that relation from the Prisma 6 client. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Init found a Prisma 6 (or Prisma 7) schema only at prisma/schema.prisma or at the path a Prisma 7-style config declares. A Prisma 6 project that names its schema in the prisma.schema field of package.json, or keeps a multi-file schema in prisma/schema/, got the generic missing-flags error, and a starter run then wrote prisma.config.ts with no warning, which breaks every Prisma 6 command. When no flag or config names a schema, detection now reads the prisma.schema field of package.json, else the first of prisma/schema.prisma, schema.prisma and the prisma/schema folder that exists. The starter warning uses the same lookup. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Prisma 6 CLI CLI.INIT_PRISMA6_SCHEMA_FOUND and orm init --help offered --target and --authoring "to scaffold a separate Prisma 8 starter project here". It is not separate: it writes prisma.config.ts into the same project, which the Prisma 6 CLI also reads, so every Prisma 6 command then fails, and its install step replaces the Prisma 6 CLI with prisma@latest. The error, the starter warning, --help, the CLI README and the error reference now say that. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nifest is not an existing app The warning said db.ts "loads only as an ES module". On Node 24 and later, which Prisma 8 requires, Node loads it in a package with no "type" and CommonJS code can require it; Node prints MODULE_TYPELESS_PACKAGE_JSON and reparses it as an ES module, and tsx loads it silently. The warning and the module settings reference now say that, and that setting "type": "module" removes the warning. A manifest with only devDependencies (typescript, tsx) counted as an existing CommonJS app and got that warning about .js files it does not have. Only runtime dependencies mark an existing app now; such a project gets "type": "module" as a new one does. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The last two steps of CLI.INIT_PRISMA6_SCHEMA_FOUND printed
`{bin} contract emit` and `{bin} db sign` literally, because the human
renderer does not substitute {bin} (#30496). The rest of init writes
`prisma ...`; these steps now use the same EMIT_COMMAND and a new
DB_SIGN_COMMAND, which init-blocks uses too.
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The coverage run showed three items on changed lines with no hits: PathExprAst.segments(), the FunctionCallAst.path() case whose identifier segments sit directly under the call node, and the init path for a Prisma 6 project that declares no Prisma 6 CLI. Tests now exercise each. The last one showed a wording defect: the printed step told the user to replace a "prisma" dev dependency the project does not have. It now says to add the "prisma6" dev dependency instead. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…at the guide For an Int in a composite type the model holds in a list (addresses Address[]), the dotted-path repair fails with "$round only supports numeric types, not array". The prisma6-int-is-a-long entry now lists documents with a double in a list or a composite field, and repairs a list of composite values with $map and $mergeObjects. The integration test runs that listing and repair against MongoDB. The int64 decode error no longer offers a single-field pipeline, which is wrong for a value inside a list. It says how to rewrite the value, to map over the list when it sits in one, and names the upgrade step that has the queries. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: prisma/orm/.coderabbit.yml Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (229)
📒 Files selected for processing (172)
💤 Files with no reviewable changes (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe pull request adds Prisma 6 MongoDB schema detection and side-by-side setup, external schema-owner handling, dotted-path parsing, MongoDB codec mappings, generated contract import filtering, and supporting tests and documentation. ChangesPrisma 6 MongoDB and schema ownership
Priority: ➖ Normal Estimated code review effort: 5 (Critical) | ~90 minutes Possibly related PRs
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change adds Prisma 6 MongoDB detection, schema-owner guidance, dotted-path parsing, and integer codec mapping. No merge-blocking issue was found. The author reports package, integration, e2e and journey tests passing, and merge depends on #30519 as noted in the description. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The ownership checks prevent conflicting schema changes, and integer reads reject incompatible values rather than silently converting them. Existing applications must accommodate bigint values and older fractional data. No introduced security defect was established, but configuration inheritance and some recovery paths remain unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 3 | ❌ 1 | ❓ 1❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The linked issue [ Resolution Split the unrelated schema-owner, codec, parser, emitter, upgrade, and general documentation changes into separate PRs, or link active issues that directly require each change. Keep this PR focused on Prisma 6 MongoDB schema detection and initialization guidance. Full details: Docstring CoverageExplanation Docstring coverage is 61.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 54 functions across 50 files. (118 skipped: 64 unsupported, 54 over the file limit.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
@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: |
size-limit report 📦
|
A contract source declared schemaOwner, and the CLI branched on it: db verify, db sign and migration status gave the owner's advice, and db init, db update, db migrate, migration plan and migration new refused with MIGRATION.SCHEMA_OWNED_ELSEWHERE. That made the framework and CLI aware of which tool authored the contract source, which ADR 252 rules out: a new source adds a package and a binding, and no branch in the CLI, the control plane or the framework. The field, its type, the config-loader schema entry, the CLI branches, the error code, the ADR bullet, the subsystem-doc paragraph, the pending upgrade entry and their tests are gone, and the CLI's drift advice is the source-agnostic wording on main again. The Prisma 6 and Prisma 7 sections of the Mongo and Postgres READMEs describe the workflow instead: apply the change with the earlier Prisma rather than the db update the CLI suggests, then contract emit and db sign. Both providers' tests now check that the source carries only its format, inputs and loader. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Prisma 6 stores a plain Int (and Int @db.Long) as a BSON long and presents it as a JavaScript number. Mapping it to mongo/int64@1 changed its application type to bigint. As Postgres has BigIntNumber (pg/int8number@1) and SQLite sqlite/bigintnumber@1, Mongo now has mongo/int64Number@1: it stores a BSON long and reads and writes a number within +-(2^53 - 1), refusing a non-integer or a value outside that range with RUNTIME.ENCODE_FAILED or RUNTIME.DECODE_FAILED. Decode takes what the driver returns for a long under every option (number, Long, bigint), and a stored fractional double gets the repair message. The codec is named by one token across its id, the PSL type (Int64Number) and the TS helper (field.int64Number()). It is registered in the target, the adapter's scalar types and the TS builder's codec type copy; a new type test checks that copy against the target's codec types for every helper. The Prisma 6 binding maps Int and Int @db.Long to it; Int @db.Int stays mongo/int32@1 and BigInt stays mongo/int64@1. The binding test now also checks that each Prisma 6 integer decodes to the type the Prisma 6 client presents. The prisma6-int-is-a-long entry keeps the fractional-value listing and repair, drops the bigint type-change steps, and says Prisma 8 now writes these fields as long. The READMEs, scalar-types.md, the codec authoring guide and the error reference describe the new codec. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ventory A stored double that is a whole number past the safe integer range, or not finite, is refused like a long past that range; a codec test now covers it. The Mongo execution-stack integration test lists every codec the adapter registers, which now includes mongo/int64Number@1. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…not as a schema owner's Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Mongo CodecTypes maps now list each codec's traits (#30519); mongo/int64Number@1 joins both copies with 'equality' | 'order' | 'numeric', and the traits test lists it. The defineConfig test that lists the Mongo scalar types now includes Int64Number. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…writes a Prisma 6 Int in lists and composites as a long The codec now lives beside mongo/int64@1 in bson-scalar-helpers.ts and codecs.ts, sharing the refusal helpers, and its messages take the Mongo form: "value must be an integer from -9007199254740991 to 9007199254740991; received 2.5". A bigint in any Mongo refusal is written with its n suffix, so passing 9n no longer reads as "received 9". The ORM and the runtime add the field, collection and document _id. The branch's own parity type test is removed: main's test compares the two CodecTypes copies whole, and fails when the builder's int64Number entry drifts. The Prisma 6 Int storage test now creates and reads the Int[] field, the embedded address and the addresses list through the ORM, checks each stored element is a long, increments and multiplies an Int, and checks the messages that name the field on write and the document _id on read. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Release `8.0.0-rc.13` → `8.0.0-rc.14` See [`docs/oss/versioning.md`](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md) for the versioning policy and the release procedure. ## What to review - **Release notes:** [`docs/releases/v8.0.0-rc.14.md`](https://github.com/prisma/orm/blob/release/8.0.0-rc.14/docs/releases/v8.0.0-rc.14.md). This file becomes the body of the GitHub Release. `CHANGELOG.md` carries the same text. The notes cover the 15 pull requests merged since `v8.0.0-rc.13`; internal refactors, process notes and documentation-only changes are left out. - **Upgrade guides:** the [app guide](https://github.com/prisma/orm/blob/release/8.0.0-rc.14/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md) and the [extension guide](https://github.com/prisma/orm/blob/release/8.0.0-rc.14/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md). They are assembled from the 5 pending fragments, which moved unchanged to `upgrade-instructions/releases/8.0.0-rc.13-to-8.0.0-rc.14/sources/`. ## What changed - The `version` of every workspace `package.json`, and the `workspace:` specifiers that name it, in the package files and in `pnpm-lock.yaml`. - The `library_version` stamp in `skills/prisma-8/SKILL.md`. - The extension version stamp in the Supabase `contract.json` and `contract.d.ts` artefacts. - The upgrade guides, the archived fragments, the release notes and the changelog. ## How the guides were assembled - Order: package changes first (`@prisma/cli-engine` pin, `temporal-polyfill` peer), then the serverless client, date and time defaults, and the Mongo ORM. - Every line of every fragment is in a guide; I checked this by script. - The `temporal-polyfill-peer` fragments had their own `#` title. The guides drop it, so each change sits under a heading that names its change id, as every other entry does. - The app guide ends with the `contract-artifacts-restamp` entry, as the previous app guides do. - The fragments had no scripts or assets. `serverless-connect-returns-connection/extension` declared `changes: []` and adds nothing. ## Checks run locally - `pnpm check:upgrade-coverage --mode publish --prev v8.0.0-rc.13 --head HEAD` passes. - `pnpm check:release-notes --mode pr --prev origin/main` passes. - `pnpm lint:docs` passes. ## Pull requests that may merge first Four approved pull requests add pending fragments: #30521, #30530, #30512 and #30331. If one merges before this one, I merge `main` into this branch, add its fragment to the guides, archive it, and add its change to the notes. CI checks the merged tree, so a leftover fragment fails the merge queue. ## Merging this pull request ships the release The push to `main` carries the new root `version`. The `Publish to npm` workflow detects the change, publishes `8.0.0-rc.14` under the dist-tag `latest`, and creates a matching GitHub Release, marked as a pre-release. ## Docs site The matching docs-site pull request follows in prisma/web. It merges after this release is published. Agent: pasteur-43 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Postgres serverless connections now expose ORM and transaction helpers. Optional cursor batching and multi-file schema support in the language server are also available. * **Bug Fixes** * Improved MongoDB encoding, decoding, query, and upsert behavior; added Node 24 date/time support and made SQLite date defaults consistent. * Improved namespace-aware relation resolution, policy placement, database-sign guidance, and upgrade instructions. * **Breaking Changes** * Updated Postgres connection and cursor behavior, canonical date/time defaults and validation, MongoDB result shapes and codec requirements, and extension and contract diagnostics. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…isma6-guides Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> # Conflicts: # packages/2-mongo-family/2-authoring/contract-prisma6/README.md # packages/2-sql/2-authoring/contract-prisma7/test/provider.test.ts
Checked every Prisma ORM claim against the v8.0.0-rc.14 tag of prisma/orm and fixed the ones the code does not support: - orm init --from-prisma7-schema writes prisma.config.ts in the project root, not in src/prisma/. Reading a Prisma 7 schema works on PostgreSQL projects only. - Hold the MongoDB Prisma 6 paragraph: the released @prisma/orm-mongo cannot read ordinary Prisma 6 schemas until prisma/orm#30521 ships. - The command is db migrate, not migrate. - Only the CLI dropped defineConfig; the one from @prisma/orm-postgres/config keeps its name. - Complete the postgresServerless upgrade steps, the // use prisma-8 behaviour for a single file, and which formatter rewrites the old header. - Add the breaking changes the list missed (config path resolution and inheritance, client-side createdAt, enum sort order, canonical date defaults, contract re-emit, db.prepare callbacks, TypeScript defaults, MongoDB Json), the .defaultSql deprecation, and five missing fixes. - Recommend prisma@7 over prisma@prev, as the release status page does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
* docs(site): add changelog entry 2026-10-02 Covers merged PRs 2026-08-28 to 2026-10-02 across the loggy-core repos. Highlights: agent enrollment with a per-agent credential and approval policy, Prisma Compute tools in the Prisma MCP server, and Prisma ORM 8 reading an existing Prisma 7 schema. Also the Accelerate retirement (December 1, 2026), the Prisma Postgres Early Access database deadline (November 1, 2026), the Prisma ORM 8 breaking changes from rc.9 to rc.14, and Postgres full-text search. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(site): tighten the 2026-10-02 entry and lead with the biggest changes Rewrites the title and the headline section headings as outcomes, splits the opening into the news and the two dates that need action, and orders the headline sections, the action list, and the fixes by impact. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(site): rewrite the 2026-10-02 entry to explain each change The entry read like a spec: clipped sentences, bold labels on most bullets, and vocabulary from the release notes. This pass follows the docs-reader-review skill. Headline and product sections are now paragraphs that start from the reader's situation, terms such as contract, promote, and Composer are explained where they first appear, and repeated statements are cut. Three cold-reader rounds. Also corrects four claims from review: the approval policy covers the agent's API requests and not deploys started by a push, orm init installs a package before its schema check, environment values are edited in place, and websearchToTsquery is described by what it accepts. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(site): correct the Prisma ORM claims in the 2026-10-02 entry Checked every Prisma ORM claim against the v8.0.0-rc.14 tag of prisma/orm and fixed the ones the code does not support: - orm init --from-prisma7-schema writes prisma.config.ts in the project root, not in src/prisma/. Reading a Prisma 7 schema works on PostgreSQL projects only. - Hold the MongoDB Prisma 6 paragraph: the released @prisma/orm-mongo cannot read ordinary Prisma 6 schemas until prisma/orm#30521 ships. - The command is db migrate, not migrate. - Only the CLI dropped defineConfig; the one from @prisma/orm-postgres/config keeps its name. - Complete the postgresServerless upgrade steps, the // use prisma-8 behaviour for a single file, and which formatter rewrites the old header. - Add the breaking changes the list missed (config path resolution and inheritance, client-side createdAt, enum sort order, canonical date defaults, contract re-emit, db.prepare callbacks, TypeScript defaults, MongoDB Json), the .defaultSql deprecation, and five missing fixes. - Recommend prisma@7 over prisma@prev, as the release status page does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> * docs(site): calmer prose and presentation for the 2026-10-02 entry Rewrite the entry so each section leads with what the reader gets, in plain sentences without setup-and-reveal phrasing. Commands, dates, migration steps, and PR links are unchanged; "contract" and "TypeScript contract" are now defined where they first appear, and the Fixes list is grouped under h3 product headings. Drop the Builder's Day section. Entry page: a larger lede paragraph, a hairline above each h2, quieter h3s, and a toned-down inline-code chip scoped to .changelog-prose so identifier-heavy bullets stop shouting. 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 Fable 5.1 <[email protected]> Co-authored-by: willbot <[email protected]>
At a glance
prisma6Schemalets a Prisma 8 project use a Prisma 6 MongoDB schema as its contract source, while Prisma 6 keeps running the app against the same database:On rc.13 it could not read this ordinary Prisma 6 schema, and it mistyped one of the fields it could read:
@@index([author.name])is a parse error,Invalid model member declaration ".", socontract emitfails.likesis mapped toInt32. Prisma 6 stores a plainIntas a BSONlong, so Prisma 8 writesintinto a field Prisma 6 fills withlong, and a validator added at cutover would refuse every document Prisma 6 wrote.After this PR the schema emits, the index gets the reader's own diagnostic, and
likesis stored as alongand read as anumber, exactly as Prisma 6 does.The decision
A Prisma 6 source reads an unmodified Prisma 6 schema and keeps what Prisma 6 does with it: the BSON type each field is stored as, and the JavaScript type the application sees. Where Prisma 8 cannot do either, the reader refuses with a diagnostic that says what the fix does to the running Prisma 6 app. Nothing outside the Prisma 6 package knows which source produced a contract; the one exception is
orm init, which already detects Prisma 7 projects on main.What is different after merge:
Int64Number, stores a BSONlongand reads it as anumber. A plain Prisma 6Intmaps to it.@db.Timestamp.orm initrecognises a Prisma 6 MongoDB project and prints the side-by-side setup, and never adds"type": "module"to an existing project.contract.d.tsimports only the codec helper types it uses.Dotted index paths
The shared PSL parser, in
packages/1-framework/2-authoring/psl-parser, accepted a dotted path in an index only as a call,author.name(sort: Asc). The plain form failed to parse, socontract emitandcontract formatboth refused the file. The parser now reads any dotted path in a list as onePathExprnode, called or not, and the language server colours both forms alike. Parse trees for everything that parsed before are unchanged; a review compared them against main over 20 groups of PSL.Each reader then decides what it supports. The Prisma 6 reader reports its composite-index diagnostic. The Prisma 8 Mongo reader refuses with
PSL_INVALID_INDEX, and says "composite type" only when the path starts at one. The Prisma 7 reader says Prisma 7 treats the path as an unknown field.Storage and types match Prisma 6
The reader's binding, in
packages/3-mongo-target/1-mongo-target/src/core/prisma6-binding.ts, maps each Prisma 6 type to a Mongo codec. A codec decides both the stored BSON type and the application type, so the binding must pick one that matches Prisma 6 on both. Checked against the Prisma 6.19.3 client, a plainIntis stored as alongand read as anumber. No Mongo codec did both:Int32storesint, andInt64reads abigint.Postgres already has this pair:
BigIntNumber(pg/int8number@1) storesint8and reads anumberwithin the safe-integer range, and SQLite has the same. Mongo gets the equivalent, named by ADR 257's rule (added by #30474): PSLInt64Number, codec idmongo/int64Number@1, helperfield.int64Number(). It stores along, reads alongas anumberwhatever the driver's BSON options, and refuses fractions and values outside the safe-integer range. A plainIntandInt @db.Longmap to it;Int @db.Intmaps toInt32, andBigInttoInt64. rc.13 could store a fractional number in such a field; reading one now fails with an error that names the value and points at the upgrade step that repairs it.The reader used to refuse every native type. It now reads the 11 that Prisma 6.19 accepts on MongoDB and that store a type Prisma 8 has a codec for, such as
@db.Long,@db.Dateand@db.ObjectId. It still refusesDateTime @db.Timestamp, because Prisma 8 has no codec for a BSON timestamp.Bytes @db.ObjectIdis stored as an ObjectId, so Prisma 8 reads and writes it as a 24-digit hex string where the Prisma 6 client uses bytes; the README shows the conversion.Diagnostics a Prisma 6 user can act on
A Prisma 6 schema still drives the Prisma 6 app, so a diagnostic that says "remove this attribute" must say what that does to the app. Each one now does. For example, dropping
onDelete: Cascadefrom a required relation makes Prisma 6 refuse to delete a parent that has children, with error P2014. Diagnostics come in source order, a wrong provider is reported alone, every bad@relationargument is reported rather than the first, and a mistyped schema path says there is no file there and to fixprisma6Schema()inprisma.config.ts.prisma7Schemagets the same missing-file message.orm init
On rc.13,
orm initin a Prisma 6 MongoDB project said "This looks like a Prisma 7 project" and suggested--from-prisma7-schema, which then failed. Init now treats a schema withprovider = "mongodb"as Prisma 6, since Prisma 7 has no MongoDB connector. It finds the schema atprisma/schema.prisma, throughprisma.schemainpackage.json, in aprisma/schema/folder, or through a Prisma 6 config. It stops before changing anything, withCLI.INIT_PRISMA6_SCHEMA_FOUND, and prints the side-by-side setup: aprisma.config.tsthat reads the schema throughprisma6Schema, aprisma6.config.tsthat keeps the Prisma 6 CLI working, and the install and emit steps. It no longer adds"type": "module"to apackage.jsonthat already has dependencies, which broke CommonJS apps. Closes #30473.The
prisma6SchemaREADMEs, inpackages/3-extensions/mongoandpackages/2-mongo-family/2-authoring/contract-prisma6, document that setup, tested end to end. Prisma 8 keeps the package nameprisma, and Prisma 6 is installed as the npm alias"prisma6": "npm:[email protected]". They list the filesdb signwrites and what changes for Prisma 6 application code. They also say what to do whendb verifyordb signfinds the database behind the contract: apply the change with Prisma 6db push, thencontract emitanddb sign. The CLI's own advice does not change.The rc.12 to rc.13 upgrade guides
The PRs that built this Mongo work were stacked, and each recorded its upgrade entry against the PR before it, not against rc.12. All of them shipped in rc.13, so the published guide described changes to things rc.12 never had. It told users that Mongo
Jsonnow refuses non-JSON values, for example, but rc.12 had no MongoJsontype at all.upgrade-instructions/README.mdallows correcting a published guide in a reviewed PR, and keeps the archived sources as submitted.The corrections, in
skills/prisma-8/upgrading/:Jsonentry, narrows the variant-field entry toObjectId, limits the scalar rename to Prisma 8 contract sources so it leaves Prisma 6 schemas alone, and describes what a stale codec import looks like underskipLibCheck.@internal/*path its@prisma/orm-*equivalent.new RegExp(pattern)over the whole file) and to skipnode_modulesand build output.contract.d.ts imports
The emitter imported every codec helper type the target declares, used or not, so a Mongo contract imported
Vectorwith no vector field. It now imports only what the contract uses. This regenerates 267 committedcontract.d.tsfiles and snapshots; only their import lines change.Upgrade instructions
prisma6-int-is-a-long(app): Prisma 8 now writes a Prisma 6Intas along, and its type staysnumber. It lists and repairs fractional values rc.13 stored in such fields, including in lists and embedded documents.prisma6-bytes-objectid-is-hex(app): native types are now read, andBytes @db.ObjectIdis read and written as a hex string.contract-dts-imports-only-used-types(extension): no action needed.Tests
Each code change has a test that fails without it:
test/integration/test/mongo/prisma6-source/that reads documents stored the way Prisma 6 stores them and checks the BSON types Prisma 8 writes back.format,inputsandload.prisma6-sourceandprisma7-sourcejourneys.Alternatives considered
InttoInt32. It keeps the type but writesintwhere Prisma 6 writeslong, and a validator at cutover would refuse Prisma 6's documents.InttoInt64. It storeslongbut changes the application type tobigint, and a Prisma 6 source must not change the types of the fields it reads.@default(false). MongoDB has no stored defaults, and contract execution defaults support generators only, so this needs a new runtime generator. The diagnostic states the consequence instead.Merge after #30519. That PR encodes Mongo list fields element by element and decodes embedded documents; without it, Prisma 6
Int[]fields cannot be written and embeddedIntfields are not decoded. This branch will be updated with main after it lands.Found by manual QA of the Mongo work in rc.13, including following the upgrade guide on a real rc.12 project.
Agent: mimir-65
🤖 Generated with Claude Code