GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat!: freeze the contract hash rules for Prisma 8, with each hash over its own section and no author value dropped by wmadden-electric · Pull Request #31203 · prisma/orm

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Nov 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

At a glance

The decision: Prisma settles how it computes a contract's hashes now, before 8.0.0, and never changes it within Prisma 8.

A contract's storage hash identifies the database it describes, and Prisma writes that one value into five places:

prisma/contract.json                                     "storageHash": "6a0532b8…"
migrations/app/20261124T0900_add_phone/migration.json    "from": "09807bbe…", "to": "6a0532b8…"
migrations/snapshots/6a0532b8…/contract.json             a copy of the contract, saved under its hash
migrations/app/refs/production.json                      "hash": "6a0532b8…"
the database's marker                                    storage hash 6a0532b8…

If a later release computed a different hash for the same contract, all five would stop agreeing at once: migrations would no longer chain, saved copies would look edited, and every database would report that it does not match its contract. So from 8.0.0 the rules are frozen. Before they are, two things about them are fixed, because neither could be fixed later.

Each hash is computed from its own part of the contract only. The storage hash used to be computed from a copy of the whole contract with the other parts blanked out:

{ "schemaVersion": "1", "targetFamily": "sql", "target": "postgres", "profileHash": "", "roots": {},
  "domain": { "namespaces": {} }, "storage": { "...": "..." }, "capabilities": {}, "extensions": {}, "meta": {} }

so the first change to the file's format version, or a new field in any blanked part, would have changed every hash. Now it is only:

{ "storage": { "...": "..." }, "target": "postgres", "targetFamily": "sql" }

Prisma keeps the values the author wrote. It used to drop every false, [] and {} from a contract except at a list of known places. This index option was written, and hashed, as {}:

{ "name": "posts_tags_idx", "type": "gin", "options": { "fastupdate": false } }

so the migration created the index without the option, and an index with it had the same hash as one without. Now a value is left out only where the database family has said that leaving it out means the same thing, such as a column's many: false.

Two smaller corrections ride along, because each also changes hashes and this is the one time that is allowed: the SQL profile hash, which covered an empty list so its check could never fail, now covers the contract's capabilities; and a table's foreign keys and a MongoDB collection's indexes are sorted before hashing, so reordering two relations no longer asks for a migration that does nothing.

The cost, once: every hash in every existing project changes. A project that used a release candidate runs a script that rewrites the hashes in its files, and signs each database again (prisma db sign, which checks that the database matches and records the new hashes in it).

What needs your decision

The repository's rules say that changes to the framework domain, packages/1-framework, need the reviewer's explicit agreement. This changes it in these ways, and I recommend accepting them:

  • the canonicalizer loses the rule that drops false and empty values, and its lists of paths, so it only sorts and encodes;
  • ContractSerializer gets one required member, normalizeStorage, in place of three optional hooks, so every family now supplies its own normal form. This is the change that alters what a family must implement;
  • prisma contract emit refuses to write a storage that does not hash to the contract's storage hash;
  • the profile hash leaves out capability flags that are off;
  • the test helper assertContractHashes and its error CONTRACT.HASH_MISMATCH are published;
  • prisma db sign gains --force.

Each reuses a concept the framework already has, and none adds family or target vocabulary to it. If you would rather keep the hooks optional, a family that supplied none would write and hash its content with no normal form, and nothing would tell it.

The decisions

  1. The hash rules are frozen for Prisma 8. Given the same contract content, every release computes the same hashes. The freeze covers the step from content to hash, not what a release writes for a contract source; a release that fixes how it reads a Prisma schema may still write different content, and the compatibility policy (Prisma 8 compatibility policy: from 8.0.0, upgrading to any later 8.x needs no changes #31193) decides when.
  2. Each hash covers targetFamily, target and its own section (storage, capabilities or execution), and nothing else, not even the file's format version.
  3. The SQL profile hash covers the contract's capabilities, leaving out flags that are off. What the list holds, and when the published lists may change, belongs to ADR 335.
  4. The framework drops no value; each family names the fields it leaves out, in one function, normalizeStorage, which is applied both when storage is written and when it is hashed.
  5. Lists whose order means nothing are sorted before hashing.
  6. Families and targets outside this repository get assertContractHashes, which recomputes the hashes of saved contracts and throws if any differs, because the freeze binds their part of the rules too.
  7. prisma db sign --force signs a database whose change policy allows only migrations. It overrides only that refusal: it still checks the database matches, changes no schema, and keeps the policy.

They are recorded in a new decision record, ADR 332, and in a rewritten ADR 010, which gives the full computation and each family's list of defaults.

Why the framework drops nothing

Where a dropped value was the family's own default, dropping it was right; where it belonged to someone else, it was a defect. A check of every place the old rule fired found these:

Value What went wrong
A PostgreSQL index's options, { fastupdate: false } Written as {}; the index was created without the option
A MongoDB partial index filter, { isAdmin: false } Written as {}, a filter that matches every document
A MongoDB clustered collection, clusteredIndex: {} Dropped, so the contract described an ordinary collection
A MongoDB collation's backwards: false, where the locale's default is true Dropped, so the locale's default applied
A type's parameters, { strict: false } Two contracts with different parameters had the same hash
A generator's parameters, { upper: false } Dropped, so the generator used its default
A false or empty value inside an entry an extension defines Dropped, so the extension read a different setting

For users of a release candidate

A project that starts on the release this ships in is not affected. A project from an earlier release candidate keeps reading files and running queries (#31200, merged), but commands that compare the contract with a database refuse until it follows the upgrade instructions, which have a version for extensions:

  1. With the release the project is on now, deploy every pending migration, so each database is at the newest contract.
  2. Upgrade Prisma, run the instructions' script, and run prisma contract emit, in either order. A run of the script that stops partway is finished by running it again.
  3. In the deploy, sign each database with prisma db sign --no-advance-ref (the flag keeps db sign from writing a file into the deploy's checkout; add --force where the database's change policy allows only migrations), then run prisma db migrate.

The instructions also cover:

  • A value the release candidate dropped, such as the index option above. contract emit writes it back, so the contract now really differs from the database. The script lists each such contract with both hashes, and the change ships as a migration; for an index option, which prisma migration plan cannot change in place, the instructions give a hand-written one.
  • A database the deploy did not reach in time, which is signed at the last migration it applied, by its directory name.

Afterwards, prisma migration status no longer shows the earlier migrations as applied, because the database's record of applied migrations holds their old hashes; nothing is applied again. The CLI refuses an extension built for an earlier release until the extension is rebuilt, and the error says what the application and the extension's author each do.

How it was verified

  • Fixed answers. The expected hashes were computed by a separate script that shares no code with the repository; the committed tests hold its answers as literals, and failed before the change. It recomputed all 697 committed contracts and every migration, and all agree.
  • Each row of the table has a test that fails on the old rule, and every default a family names was checked against the database's own default.
  • A byte-identical rewrite: 322 contracts this release emitted, across all five databases, read and write back unchanged.
  • The upgrade. The script's tests run on projects that 8.0.0-rc.25 itself emitted, planned and migrated, including ones with an emptied index option and a policy, in both orders, interrupted at every point, and run twice. By hand, on real 8.0.0-rc.25 PostgreSQL and MongoDB projects and databases: both orders; a project with fastupdate: false, ending with the option set on the index; a migrations-only database with --force, and --force refusing one whose schema does not match; a database a migration behind.
  • Review. Independent design and code reviews of each part and of the final branch.
  • CI runs the package suites here; the merge queue runs the integration and end-to-end suites, and the integration tests closest to the diff were also run one by one.

The branch is one commit: the sign-off check cannot read a pull request of more than 250 commits, so the history was squashed. The full history is kept on ga-compat-hashes-backup-pre-squash.

Known gaps

Recorded in the project's follow-up list:

  • A TypeScript contract used without emitting can log a false marker warning when the configuration names an extension its source does not. No hash changes, so it can be fixed in any release.
  • Some MongoDB validator lists keep an order that means nothing, such as the branches of a derived oneOf. Sorting them could make the planner propose changing a validator that is already right in a live database, so they were left; after 8.0.0 that order is frozen until Prisma 9.

API changes

Application code changes nothing. These are for authors of a family, a target, an extension or a tool built on the toolchain. Each package's api-breaks.json records its breaks against 8.0.0-rc.25.

The changed exports
  • @prisma/orm-framework: new assertContractHashes, AssertContractHashesOptions, SavedContractHashes and HashedContractSections, the test helper of decision 6. ContractSerializer has one required normalizeStorage (type NormalizeStorage) in place of the optional shouldPreserveEmpty, sortStorage and hash hooks, because the framework no longer drops values. CanonicalizeContractOptions and the storage hash's arguments follow. Removed with the dropping rule: createPreserveEmptyPredicate, matchesPathPattern, PathPattern, PreserveEmptyPathSegment, PreserveEmptyPredicate and StorageSort; createStorageSort now orders by name, then content.
  • @prisma/orm-family-sql: sqlContractCanonicalizationHooks is replaced by normalizeSqlStorage and normalizeSqlDomain, on a new entry contract/normal-form, because the family now names its defaults. SqlContractSerializerBase supplies normalizeStorage.
  • @prisma/orm-family-mongo: mongoContractCanonicalizationHooks is replaced by normalizeMongoStorage and normalizeMongoDomain, on contract/normal-form, for the same reason; MongoContractSerializerBase supplies normalizeStorage.
  • @prisma/orm-postgres, @prisma/orm-mysql, @prisma/orm-mariadb, @prisma/orm-sqlite and @prisma/orm-mongo: each re-exports the framework's and its family's changed entries, contract/hashing and contract/normal-form in place of contract/canonicalization-hooks.
  • @prisma/orm-target-postgres: PostgresContractSerializer no longer overrides which empty values are kept, because nothing is dropped.
  • @prisma/orm-target-mysql, @prisma/orm-target-sqlite and @prisma/orm-target-mongo: each contract serializer inherits normalizeStorage from its family's base.
  • @prisma/orm-toolchain: prisma db sign gains --force (DbSignOptions, ExecuteDbSignOptions, ExecuteDbSignSuccess), decision 7. EmitOptions takes the family's normalizeStorage, and emit refuses a storage whose hash does not match. createSnapshotContentVerifier and DescriptorSelfConsistencyInputs take normalizeStorage, and SnapshotCanonicalizationHooks goes, because MongoDB snapshots are now checked like SQL ones.
  • @prisma/orm-extension-supabase: no export changes; its bundled contract has new hashes, so the hash literal types in its api.txt changed.

Reviewing the diff

A suggested reading order

About 1,400 of the roughly 1,660 changed files are the repository's own contracts, migrations, snapshots and refs, rewritten by the script or emitted again. Read the rest in this order:

  1. packages/1-framework/0-foundation/contract/src/hashing.ts and canonicalization.ts: the new inputs, and a canonicalizer that only sorts.
  2. Each family's normal-form.ts, in packages/2-sql-family/1-core/contract and packages/2-mongo-family/1-foundation/mongo-contract, with their tests.
  3. The fixed-answer tests, hash-rules.fixed-answers.test.ts.
  4. enrichContract in the CLI and the SQL contract builder: the capability fix.
  5. db sign --force in the CLI.
  6. The upgrade instructions and script, with the script's tests in test/integration/test/upgrade-instructions/contract-hash-inputs/.
  7. ADR 332 and ADR 010.

Tests main already had that changed: the end-to-end test of a project exactly as the last release candidate left it keeps its assertions, and its comment now says a database that release candidate signed needs the upgrade steps; two examples expect foreign keys and MongoDB indexes in the sorted order.

Alternatives considered

On the hash inputs:

  • Freeze the old input. Rejected: the format version and the blanked parts would stay in every hash, so the first format change would change them all.
  • Hash the file as written, by its format version's rules. Rejected: the hash would change when a later format version lays out storage differently.
  • Record which rules produced a hash, and support several. Rejected: a project would hold hashes computed two ways, and every comparison would need converting. Git's plan for a new hash function rules out mixing two in one repository for the same reason.

On what goes into each part:

  • Keep the dropping rule and add the missing exceptions. Rejected: the list grew with every defect found, and the next would be found after the freeze. A rule that keeps everything fails loudly when a family forgets a default; the old one failed silently.
  • Require that false and empty always mean absent inside values a family does not own. Rejected: an unchecked convention for outside authors, where a violation gives two different contracts one hash.
  • Fix the SQL profile hash later, in the capabilities work. Rejected: that work also lands before 8.0.0, so the rule would change twice and every project would be signed twice.

On moving existing databases:

  • A migration from each old hash to its new one. Rejected: one extra migration for every old hash a database could be at, each starting from a hash with no saved copy.
  • Rewrite the database's record of applied migrations, so migration status keeps its history. Rejected: a write to every database's history table for a display; nothing reads it to decide what to apply.
  • Exempt db sign from the change policy. Rejected: signing could then hide, on any database, that it left its migration history. --force keeps that a deliberate act, and it stays for recovering a database the upgrade did not reach.

Agent: alexvanhalen-55

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@wmadden-electric
wmadden-electric requested a review from a team as a code owner November 24, 2026 12:26
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review skipped: 1072 files exceed the limit of 300

Walkthrough

Warning

Review details and warnings were omitted to fit the comment limit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pkg-pr-new

pkg-pr-new Bot commented Nov 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-better-auth

npm i https://pkg.pr.new/@prisma/orm-better-auth@31203

@prisma/orm-extension-arktype-json

npm i https://pkg.pr.new/@prisma/orm-extension-arktype-json@31203

@prisma/orm-extension-middleware-cache

npm i https://pkg.pr.new/@prisma/orm-extension-middleware-cache@31203

@prisma/orm-extension-paradedb

npm i https://pkg.pr.new/@prisma/orm-extension-paradedb@31203

@prisma/orm-extension-pgvector

npm i https://pkg.pr.new/@prisma/orm-extension-pgvector@31203

@prisma/orm-extension-postgis

npm i https://pkg.pr.new/@prisma/orm-extension-postgis@31203

@prisma/orm-extension-supabase

npm i https://pkg.pr.new/@prisma/orm-extension-supabase@31203

@prisma/orm-family-mongo

npm i https://pkg.pr.new/@prisma/orm-family-mongo@31203

@prisma/orm-family-sql

npm i https://pkg.pr.new/@prisma/orm-family-sql@31203

@prisma/orm-framework

npm i https://pkg.pr.new/@prisma/orm-framework@31203

@prisma/orm-mariadb

npm i https://pkg.pr.new/@prisma/orm-mariadb@31203

@prisma/orm-mongo

npm i https://pkg.pr.new/@prisma/orm-mongo@31203

@prisma/orm-mysql

npm i https://pkg.pr.new/@prisma/orm-mysql@31203

@prisma/orm-postgres

npm i https://pkg.pr.new/@prisma/orm-postgres@31203

@prisma/orm-postgres-contrib

npm i https://pkg.pr.new/@prisma/orm-postgres-contrib@31203

@prisma/orm-sqlite

npm i https://pkg.pr.new/@prisma/orm-sqlite@31203

@prisma/orm-target-mariadb

npm i https://pkg.pr.new/@prisma/orm-target-mariadb@31203

@prisma/orm-target-mongo

npm i https://pkg.pr.new/@prisma/orm-target-mongo@31203

@prisma/orm-target-mysql

npm i https://pkg.pr.new/@prisma/orm-target-mysql@31203

@prisma/orm-target-postgres

npm i https://pkg.pr.new/@prisma/orm-target-postgres@31203

@prisma/orm-target-sqlite

npm i https://pkg.pr.new/@prisma/orm-target-sqlite@31203

@prisma/orm-toolchain

npm i https://pkg.pr.new/@prisma/orm-toolchain@31203

commit: e67cc8c

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Nov 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 311.71 KB (-0.1% 🔽)
postgres / emit 271.83 KB (-0.14% 🔽)
mongo / no-emit 243.64 KB (+0.06% 🔺)
mongo / emit 198.15 KB (+0.39% 🔺)
cf-worker / no-emit 377 KB (-0.09% 🔽)
cf-worker / emit 332.56 KB (-0.07% 🔽)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wmadden-electric
wmadden-electric marked this pull request as draft November 24, 2026 12:36
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 24, 2026 12:38
@wmadden-electric
wmadden-electric marked this pull request as draft November 24, 2026 23:28
@wmadden-electric wmadden-electric changed the title feat!: every contract hash covers only what it is about, changes once now, and keeps its rules for the rest of Prisma 8 feat!: every contract hash changes once, to cover only its own part of the contract, and its rules are frozen for Prisma 8 Nov 25, 2026
@wmadden-electric wmadden-electric mentioned this pull request Nov 25, 2026
feat!: stored files carry a format version, and readers refuse what they do not know #31200
Merged
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 25, 2026 15:55
@wmadden-electric wmadden-electric mentioned this pull request Nov 25, 2026
feat(postgres)!: a PostgreSQL contract lists the capabilities it requires (optional, with a warning, until 8.0) #31218
Merged
@wmadden-electric
wmadden-electric marked this pull request as draft November 26, 2026 12:40
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 26, 2026 13:02
@wmadden-electric
wmadden-electric marked this pull request as draft November 26, 2026 22:48
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 26, 2026 23:05
wmadden-electric added a commit that referenced this pull request Nov 27, 2026
@wmadden-electric @claude
docs: capability statements scoped to PostgreSQL where only PostgreSQ…
ff12ba8
…L holds them

The subsystem docs, the capabilities reference and the capability-gating pattern now say that on PostgreSQL the target and driver declare capabilities and the client checks its connection, while on MySQL, MariaDB and SQLite the adapter's fixed list goes into every contract and no client check runs. They also say the SQL profile hash covers no capabilities today, until #31203.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as draft November 27, 2026 08:24
@wmadden-electric wmadden-electric mentioned this pull request Nov 27, 2026
feat(postgres)!: Prisma's own tables move to schema _prisma and are brought up to date before every command that changes a database #31234
Draft
shu-chen-dot-ca pushed a commit to shu-chen-dot-ca/orm that referenced this pull request Nov 27, 2026
@wmadden-electric @claude
feat(postgres)!: a PostgreSQL contract lists the capabilities it requ…
134a5f5
…ires (optional, with a warning, until 8.0) (prisma#31218)

## At a glance

A *capability* is a named yes-or-no feature of the environment a
PostgreSQL application runs in, such as `sql.lateral` (the database has
lateral joins) or `sql.interactiveTransactions` (the connection can hold
a transaction open). Until now every PostgreSQL contract was given the
same fixed set, whatever the project ran on.

A contract now lists the capabilities it requires, from two lists Prisma
exports: one for a PostgreSQL version, one for the driver's connection.

```ts
import { defineContract, postgres18, postgresDriver } from '@prisma/orm-postgres/contract-builder';

export const contract = defineContract({
  requiredCapabilities: [...postgres18, ...postgresDriver],
  // models…
});
```

A project that has not added the list yet keeps working until 8.0. When
it runs `prisma contract emit`, it gets a warning with the exact text to
add:

```text
Your contract does not list the capabilities it requires, so it requires those of the newest PostgreSQL version and of the driver. Prisma 8.0 removes this default and requires the list. Write this in defineContract, with its import:

requiredCapabilities: [...postgres18, ...postgresDriver]

import { postgres18, postgresDriver } from '@prisma/orm-postgres/contract-builder';
```

## The decision

**The problem.** A project could type-check a feature its environment
lacks and find out when a query failed, for three reasons:

- Every contract required the same capabilities, so it said nothing
about the project's real database or connection.
- Signing a database (`prisma db sign`, which records that a database
matches a contract) never compared the database with the contract's
capabilities.
- When the client started, it added the capabilities of its own
components to the contract's. A feature the contract did not require
still ran.

**The decision.** Capabilities are a contract's dependencies. A database
version or a connection **provides** them, and a contract **requires**
them. Three rules follow:

1. **The author writes the list.** `requiredCapabilities` is everything
the contract requires. From 8.0 it is required and has no default, so
every capability an error names is one the author can find in their own
source.
2. **Signing checks the database.** The commands that verify or change a
database compare the server's version with a table of which PostgreSQL
version provides which capability, and refuse a database that lacks one
the contract requires.
3. **The client goes by the contract.** It no longer adds capabilities
of its own. A feature whose capability the contract does not require is
unavailable. A capability the contract requires that the connection does
not provide is a type error where the client is created, and a warning
when it starts.

**What breaks, and for whom.** For a project on release candidate 25
that uses the PostgreSQL package's `defineConfig`: nothing, until 8.0
(the stopgap below). Three things do change:

- A server older than PostgreSQL 15 is now refused by `db sign`, `db
verify`, `db init`, `db update` and `db migrate`. Before, only `init
--probe-db` warned about it.
- A config that names the target, adapter and driver by hand, with the
framework's `defineConfig` and not the PostgreSQL package's, gets no
default. Its next emit writes a contract with no capabilities. The
upgrade instructions detect this form and give the one line to add.
- At 8.0 the list becomes required.

**Why before 8.0.** A required input and a change to which capabilities
a contract contains would each need a major version afterwards.

## How it works

### Two lists

| What | Declared by | Exported as |
| --- | --- | --- |
| What each PostgreSQL version provides | The PostgreSQL target, in a
table of versions 15 to 18 | `postgres15` … `postgres18` |
| What the connection provides | The driver | `postgresDriver` |

They are separate because they change separately. A project behind a
connection pooler that cannot hold a transaction open keeps its
database's list and leaves `sql.interactiveTransactions` out.

All four version lists are equal today: no feature Prisma supports needs
more than PostgreSQL 15. So it does not matter yet which one a project
spreads, and `init` writes the newest. A version's list is fixed for a
major version of Prisma, and a test pins each one. A feature that needs
a newer server arrives with a new list, such as `postgres19`, so a
project that spreads `postgres18` on a PostgreSQL 15 server is never
refused by a later minor release.

A capability is removed by leaving it out: `postgres18.filter((key) =>
key !== 'sql.jsonAgg')`. TypeScript infers a type predicate from that
comparison, so the key leaves the contract's type too, and the features
that need it stop type-checking. A test covers it.

### Where the list is written

- **A TypeScript contract:** in `defineContract`, as above.
- **A contract in the Prisma schema language:** in the config, because
the schema language has no syntax for it yet. That syntax is designed
and not built; the config entry is a stopgap for it.

  ```ts
import { defineConfig as ormConfig, postgres18, postgresDriver } from
'@prisma/orm-postgres/config';

  orm: ormConfig({
    contract: {
      path: './prisma/contract.prisma',
      requiredCapabilities: [...postgres18, ...postgresDriver],
    },
    db: { connection: process.env['DATABASE_URL']! },
  })
  ```

- **A project that keeps its Prisma 7 schema:** `prisma7Schema(path, {
requiredCapabilities })`.

`prisma orm init` writes the list into a new project. `contract.json`
stores the capability keys in its `capabilities` field, in the same
shape as before, and never a database version.

### What is checked, and what the user sees

**The database lacks a required capability.** `db verify`, `db sign`,
`db init`, `db update` and `db migrate` print one message and change
nothing. They suggest no command, because none upgrades a server. The
capability in this example does not exist; it stands for one that
PostgreSQL would have from version 17:

```text
Your contract requires database capabilities first available in PostgreSQL 17 (sql.notARealCapability), but this database runs PostgreSQL 15.4. Either upgrade the database, or remove them from your contract's required capabilities.
```

One limit: signing checks only the capabilities in its version table. It
cannot tell a database capability it does not know from a connection
capability, so the client reports those instead. The next pull request
removes this limit (see "Not in this pull request").

**The connection lacks a required capability.** Where the application
imports the contract's generated types, creating the client is a type
error that names the capability. When the client starts, it logs a
warning:

```text
Your contract requires `sql.interactiveTransactions`, which this client's connection does not provide. Remove it from your contract's required capabilities, or connect with a driver that provides it.
```

It is a warning and not a failure because the client's checks at start
never stop a running application; `prisma db verify` is the command that
fails a deploy.

**A feature's capability is not in the list.** The call is refused, and
it is a type error where TypeScript can see the need, as with
`transaction()`. Every such refusal now has one form (there were six):

```text
`transaction()` is unavailable: your contract declares no dependency on `sql.interactiveTransactions`. To enable it, add `sql.interactiveTransactions` to your contract's required capabilities.
```

## Release candidate projects keep working

The goal: a project exactly as release candidate 25 left it, with its
config, its contract source and its emitted `contract.json` unchanged,
keeps type-checking, emitting and running after it upgrades, with
warnings only. Three things make that so. All three are a stopgap,
removed at 8.0.

1. **A missing list gets a default:** the newest version's list and the
driver's, which is what `init` writes. The CLI commands that load the
contract's source, such as `contract emit`, print the warning shown at
the top, with text that compiles when pasted. An application that loads
its contract prints nothing.
2. **Retired flags are ignored.** A release candidate's `contract.json`
lists nine flags that nothing ever read: `postgres.orderBy`,
`postgres.limit`, `postgres.lateral`, `postgres.jsonAgg`,
`postgres.returning`, `sql.enums`, and three that extensions declared
(`pgvector.cosine`, `postgis.geometry`, `paradedb/bm25`). The live flags
`sql.lateral` and `sql.jsonAgg` are different keys and stay. This pull
request stops emitting the nine, and the client's check skips them, so
an old `contract.json` type-checks and starts without a warning. A
retired flag written into a new list is refused.
3. **An old `contract.json` can still call `transaction()`.** The
default in point 1 only helps once a project emits again. Until then its
`contract.json` has no `sql.interactiveTransactions`, because that flag
is new. A contract that lists a retired flag can only have come from a
release candidate, whose clients all offered `transaction()`, so it is
allowed.

**The proof.** A test takes three projects' files from the tag
`v8.0.0-rc.25`, byte for byte and pinned by checksum, and checks that
each type-checks, emits with the warning, creates a client with no
warning, and runs a query and a `transaction()`. It runs in pull request
CI.

**What a project does.** Nothing before 8.0. To stop the warning: add
the list as the warning shows, and run `prisma contract emit`. This pull
request alone does not require signing databases again. prisma#31203
will, because it makes a contract's signature cover its capability list.

**Removing it.** Every declaration that is part of the stopgap has
"Prisma 8.0 removes" in its doc comment, so one search finds them all.

## Changes to the framework

The framework packages must not know about any one database, so each
change there is listed with why it is there:

- **A database that lacks capabilities, as data.** A target returns its
findings (capabilities a version lacks, a server older than supported, a
version it could not read), and one framework function turns them into
the message. It is in the framework so the message reads the same for
every database and the CLI can recognise it. `PostgreSQL` in the text
comes from the target.
- **The CLI gives no advice to change a refused database.** After a
failed verification the CLI normally suggests `db update`. It gives no
such advice while the database is refused, because those commands are
refused too.
- **`init` asks the database package for the config's `contract:`
entry.** The CLI writes `prisma.config.ts` and cannot know what a
database's entry contains. An optional `contractEntry` member returns
it, written with the tools migration files are already written with: an
object that renders TypeScript source and lists the imports it needs.
Without the member, `init` writes the path as before.
- **A lint limit rises from 139 to 143.** The check that counts lines
naming a database under the framework packages rises by four. The lines
are in the CLI's two recorded PostgreSQL test contracts, which now
import and list the two capability lists. No framework source line names
a database.

## API changes

- `@prisma/orm-postgres`: `defineContract`, the config's contract entry
and `prisma7Schema` take `requiredCapabilities`; the lists `postgres15`
to `postgres18` and `postgresDriver` and the type `RequiredCapabilities`
are added; `postgresContractCapabilities` builds a capability set from a
list; the client's type checks its connection against the contract; and
the `init` entrypoint returns the config's contract entry.
- `@prisma/orm-target-postgres`: the target holds the table of
capabilities by version, the server version range and the retired
capabilities; its adapter and its control descriptors declare no
capabilities, and the driver declares `sql.interactiveTransactions`.
- `@prisma/orm-family-sql`: the client's check of its connection
(`StackProvides`, `capabilitiesNotProvided` and the types around them),
the one message for an unavailable feature
(`capabilityUnavailableMessage`, which replaces
`missingCapabilityRemedy`), the check for `transaction()`, the target
hook `databaseCapabilitiesNotProvided`, and
`isSourceGivenNoCapabilities` for the release candidate default.
- `@prisma/orm-framework`: the types and the text function for a
database that does not provide what a contract requires
(`DatabaseCapabilitiesNotProvided` and the names around it), and the
mismatch explanation that carries it.
- `@prisma/orm-toolchain`: the `init` contribution's `contractEntry`
member and its types (`ContractEntryNode`, `ContractEntryInput`,
`ConfigModuleExports`).
- `@prisma/orm-extension-supabase`: its client checks its connection
against the contract, as the PostgreSQL client does, so its client and
`RoleBoundDb` types change.
- `@prisma/orm-extension-pgvector`, `@prisma/orm-extension-postgis` and
`@prisma/orm-extension-paradedb`: each stops declaring a capability flag
that nothing read, so its pack's type loses the `capabilities` field.
- `@prisma/orm-better-auth`: `prismaAdapter` requires a client with
`transaction()` only when the `transaction` option is on, and reads the
client's retired capabilities so a release candidate contract is
accepted.
- `@prisma/orm-target-mysql`, `@prisma/orm-target-mariadb` and
`@prisma/orm-target-sqlite`: each adapter's capability list gains
`sql.interactiveTransactions`, which `transaction()` now requires of a
contract.
- `@prisma/orm-mysql`, `@prisma/orm-mariadb` and `@prisma/orm-sqlite`:
each re-exports the SQL family's new `capability-messages` entry.

- `@prisma/orm-family-mongo`, `@prisma/orm-mongo` and
`@prisma/orm-target-mongo`: no export of theirs changes; each gains
records, because their verification types include the cause of a schema
difference, which gains a member (below).

**Breaks against release candidate 25, each recorded in its package's
`api-breaks.json`.** These reach code written against the packages'
lower-level types, such as tooling and extensions. Only the
`transaction()` one touches code an application writes, and a release
candidate's contract can still call it.

- The cause of a schema difference can now be
`database-capabilities-not-provided`, and the migration runner can fail
with `MIGRATION.DATABASE_CAPABILITIES_NOT_PROVIDED`. Code that handles
every cause or every code stops compiling until it handles the new one.
This one cause is 321 of the 363 records, in every package whose types
include it.
- The PostgreSQL schema tree holds the server's version as the number
`serverVersionNumber` in place of the text `pgVersion`.
- The PostgreSQL adapter and the extension packs declare no
capabilities.
- `transaction()` is a type error for a contract that does not require
`sql.interactiveTransactions`.
- The Supabase contract's capabilities lose the retired flags.

Four things stay as release candidate 25 had them until 8.0, so that
code written against it keeps compiling: the import paths of
`POSTGRES_MIN_SERVER_VERSION` and `postgresAdapterCapabilities`, the
fifth argument of `renderLoweredSql`, and the `driver` option of
`createExecutionContext`. The last two are ignored. The API check cannot
see a removed parameter, so a type test covers each.

## Merge order

prisma#31203 makes a contract's signature cover its capability list.
The two pull requests can merge in either order. Whichever merges second
regenerates the emitted fixtures.

## Reading the diff

Most changed files are mechanical: about 450 configs, contracts,
examples and tests gained the list. The substance is in:

- `packages/3-targets/postgres/1-target/src/core/server-version.ts` and
`retired-capabilities.ts`: the table of versions and the retired flags.
- `packages/3-targets/postgres/9-facade/src/contract/` and
`src/config/`: the list, the default and the warning.
- `packages/2-sql-family/5-runtime/src/stack-capabilities.ts`: the
client's check.
-
`packages/1-framework/1-core/framework-components/src/control/database-capabilities-not-provided.ts`:
the refusal as data.
- `packages/1-framework/3-tooling/cli/src/commands/init/` and
`packages/3-targets/postgres/9-facade/src/init/`: what `init` writes.
- `test/e2e/framework/test/release-candidate-project.test.ts`: the proof
for release candidate projects.
- `docs/architecture docs/adrs/ADR 335 - A contract lists the
capabilities it requires.md`: the decision record.

## Not in this pull request

- **Renaming what is stored.** `contract.json` still calls the field
`capabilities`, and keys still start with `sql.` or `postgres.`. The
next pull request, before 8.0, renames the field to
`requiredCapabilities` and prefixes each key by its provider (`db.` or
`conn.`). Signing can then refuse any database capability its table does
not know. It is separate because it is a pure rename across about 700
hand-written files.
- **MySQL, MariaDB, SQLite and MongoDB.** They keep a fixed list from
their adapter until each is built the same way. They are not at general
availability.

## Alternatives considered

- **Requiring the list at once.** Every project on a release candidate
would stop emitting until it added a line it has never seen, and its
existing `contract.json` would stop type-checking.
- **A default kept for good.** The requirements would not be in the
author's source, and a default built from the newest version would
change every such contract when a newer version is added.
- **A version number (`databaseVersion: 17`) in place of a list.** It
hid the connection's capabilities behind a default, and the number read
as the exact version the database runs, when it is the oldest the
contract supports.
- **One list per version that already includes the driver's
capabilities.** It would hide that the connection's capabilities are
separate, which is what a project behind a pooler has to change.
- **One name for both sides (`capabilities`).** "The contract's
capabilities" reads as what the contract can do.
- **The client reads the database's capabilities when it connects.** The
client already compares the database's signature with the contract's at
start, and signing has checked the capabilities by then. A second check
would cost a query at every start for nothing.
- **A default for hand-built configs too.** It would take a second
temporary mechanism, in the target and the contract source builders, for
a form the docs taught only to extension authors and to applications
that assemble their config by hand.

Linear: TML-3960

Agent: heathcliff-78
🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Public API changes

This pull request changes the api.txt list of 11 packages and the recorded breaks or expected example-app errors of 14 packages or apps. Its description needs a section headed ## API changes that names each export below, in backticks, on a line that says why it changes. A package name in backticks, on a line with a reason, covers every change in that package. A change to a package’s api-breaks.json is named by the package, and a change to examples/last-release-errors.json by examples/<app>. You can start from this:

## API changes

- `@prisma/orm-extension-supabase`:
- `@prisma/orm-extension-supabase (not exported): ProfileHash`:
- `@prisma/orm-extension-supabase (not exported): StorageHash`:
- `@prisma/orm-family-mongo`:
- `@prisma/orm-family-mongo/contract/canonicalization-hooks: mongoContractCanonicalizationHooks`:
- `@prisma/orm-family-mongo/contract/normal-form: normalizeMongoDomain`:
- `@prisma/orm-family-mongo/contract/normal-form: normalizeMongoStorage`:
- `@prisma/orm-family-mongo/family/ir: MongoContractSerializerBase`:
- `@prisma/orm-family-mongo/family: MongoContractSerializerBase`:
- `@prisma/orm-family-sql`:
- `@prisma/orm-family-sql/contract/canonicalization-hooks: sqlContractCanonicalizationHooks`:
- `@prisma/orm-family-sql/contract/normal-form: normalizeSqlDomain`:
- `@prisma/orm-family-sql/contract/normal-form: normalizeSqlStorage`:
- `@prisma/orm-family-sql/contract: normalizeSqlDomain`:
- `@prisma/orm-family-sql/contract: normalizeSqlStorage`:
- `@prisma/orm-family-sql/contract: sqlContractCanonicalizationHooks`:
- `@prisma/orm-family-sql/family/ir: SqlContractSerializerBase`:
- `@prisma/orm-family-sql/family: SqlContractSerializerBase`:
- `@prisma/orm-framework`:
- `@prisma/orm-framework (not exported): ComputeStorageHashArgs`:
- `@prisma/orm-framework/components/control: ContractSerializer`:
- `@prisma/orm-framework/components: ContractSerializer`:
- `@prisma/orm-framework/contract/hashing-utils: PathPattern`:
- `@prisma/orm-framework/contract/hashing-utils: PreserveEmptyPathSegment`:
- `@prisma/orm-framework/contract/hashing-utils: createPreserveEmptyPredicate`:
- `@prisma/orm-framework/contract/hashing-utils: createStorageSort`:
- `@prisma/orm-framework/contract/hashing-utils: matchesPathPattern`:
- `@prisma/orm-framework/contract/hashing: AssertContractHashesOptions`:
- `@prisma/orm-framework/contract/hashing: CanonicalizeContractOptions`:
- `@prisma/orm-framework/contract/hashing: HashedContractSections`:
- `@prisma/orm-framework/contract/hashing: NormalizeStorage`:
- `@prisma/orm-framework/contract/hashing: PreserveEmptyPredicate`:
- `@prisma/orm-framework/contract/hashing: SavedContractHashes`:
- `@prisma/orm-framework/contract/hashing: StorageSort`:
- `@prisma/orm-framework/contract/hashing: assertContractHashes`:
- `@prisma/orm-framework/contract: AssertContractHashesOptions`:
- `@prisma/orm-framework/contract: CanonicalizeContractOptions`:
- `@prisma/orm-framework/contract: HashedContractSections`:
- `@prisma/orm-framework/contract: NormalizeStorage`:
- `@prisma/orm-framework/contract: PathPattern`:
- `@prisma/orm-framework/contract: PreserveEmptyPathSegment`:
- `@prisma/orm-framework/contract: PreserveEmptyPredicate`:
- `@prisma/orm-framework/contract: SavedContractHashes`:
- `@prisma/orm-framework/contract: StorageSort`:
- `@prisma/orm-framework/contract: assertContractHashes`:
- `@prisma/orm-framework/contract: createPreserveEmptyPredicate`:
- `@prisma/orm-framework/contract: createStorageSort`:
- `@prisma/orm-framework/contract: matchesPathPattern`:
- `@prisma/orm-mariadb`:
- `@prisma/orm-mariadb/family-contract/canonicalization-hooks: everything from @prisma/orm-family-sql/contract/canonicalization-hooks`:
- `@prisma/orm-mariadb/family-contract/normal-form: everything from @prisma/orm-family-sql/contract/normal-form`:
- `@prisma/orm-mongo`:
- `@prisma/orm-mongo/family-contract/canonicalization-hooks: everything from @prisma/orm-family-mongo/contract/canonicalization-hooks`:
- `@prisma/orm-mongo/family-contract/normal-form: everything from @prisma/orm-family-mongo/contract/normal-form`:
- `@prisma/orm-mysql`:
- `@prisma/orm-mysql/family-contract/canonicalization-hooks: everything from @prisma/orm-family-sql/contract/canonicalization-hooks`:
- `@prisma/orm-mysql/family-contract/normal-form: everything from @prisma/orm-family-sql/contract/normal-form`:
- `@prisma/orm-postgres`:
- `@prisma/orm-postgres/family-contract/canonicalization-hooks: everything from @prisma/orm-family-sql/contract/canonicalization-hooks`:
- `@prisma/orm-postgres/family-contract/normal-form: everything from @prisma/orm-family-sql/contract/normal-form`:
- `@prisma/orm-sqlite`:
- `@prisma/orm-sqlite/family-contract/canonicalization-hooks: everything from @prisma/orm-family-sql/contract/canonicalization-hooks`:
- `@prisma/orm-sqlite/family-contract/normal-form: everything from @prisma/orm-family-sql/contract/normal-form`:
- `@prisma/orm-target-mongo`:
- `@prisma/orm-target-mysql`:
- `@prisma/orm-target-postgres`:
- `@prisma/orm-target-postgres/target/runtime: PostgresContractSerializer`:
- `@prisma/orm-target-postgres/target: PostgresContractSerializer`:
- `@prisma/orm-target-sqlite`:
- `@prisma/orm-toolchain`:
- `@prisma/orm-toolchain (not exported): ExecuteDbSignSuccess`:
- `@prisma/orm-toolchain/cli/control-api: DbSignOptions`:
- `@prisma/orm-toolchain/cli/control-api: ExecuteDbSignOptions`:
- `@prisma/orm-toolchain/emitter: EmitOptions`:
- `@prisma/orm-toolchain/migration-tools/contract-snapshot-store: SnapshotCanonicalizationHooks`:
- `@prisma/orm-toolchain/migration-tools/contract-snapshot-store: createSnapshotContentVerifier`:
- `@prisma/orm-toolchain/migration-tools/spaces: DescriptorSelfConsistencyInputs`:
- `@prisma/orm-toolchain/migration-tools: DescriptorSelfConsistencyInputs`:
- `@prisma/orm-toolchain/migration-tools: SnapshotCanonicalizationHooks`:
- `@prisma/orm-toolchain/migration-tools: createSnapshotContentVerifier`:

packages/9-public/@prisma/orm-extension-supabase/api-breaks.json

- {"path":"./runtime","export":"ServiceRoleDb","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"3c9d16b4eda4510c","reason":"A column name that several joined tables share must now name its table (prisma/orm#31150), and `transaction()` is a type error for a contract that does not require `sql.interactiveTransactions`; a release candidate's contract may still call it (prisma/orm#31218)."}
+ {"path":"./runtime","export":"ServiceRoleDb","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"81c677c9323a6992","reason":"A column name that several joined tables share must now name its table (prisma/orm#31150), and `transaction()` is a type error for a contract that does not require `sql.interactiveTransactions`; a release candidate's contract may still call it (prisma/orm#31218). The Supabase contract's storage and profile hash literals also take the values this release's hash rules give the same contract (ADR 332)."}
+ {"path":"./runtime","export":"SupabaseDb","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"913f5d0c24b08e6d","reason":"A column name that several joined tables share must now name its table (prisma/orm#31150), and `transaction()` is a type error for a contract that does not require `sql.interactiveTransactions`; a release candidate's contract may still call it (prisma/orm#31218). The Supabase contract's storage and profile hash literals also take the values this release's hash rules give the same contract (ADR 332)."}
- {"path":"./runtime","export":"SupabaseDb","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"d355ac44c3abb036","reason":"A column name that several joined tables share must now name its table (prisma/orm#31150), and `transaction()` is a type error for a contract that does not require `sql.interactiveTransactions`; a release candidate's contract may still call it (prisma/orm#31218)."}
- {"path":"./runtime","export":"SupabaseExtensionContract","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"aa1d211f375e6a3c","reason":"The Supabase contract's capabilities are the ones it requires; the `postgres` flags this release retired, such as `jsonAgg`, are gone (prisma/orm#31218)."}
+ {"path":"./runtime","export":"SupabaseExtensionContract","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"ab3d7907c1ecb1ad","reason":"The Supabase contract's capabilities are the ones it requires; the `postgres` flags this release retired, such as `jsonAgg`, are gone (prisma/orm#31218). Its storage and profile hash literals also take the values this release's hash rules give the same contract (ADR 332)."}
+ {"path":"./runtime","export":"SupabaseInternalDb","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"05bcb076bb9d1760","reason":"The Supabase contract's capabilities are the ones it requires; the `postgres` flags this release retired, such as `jsonAgg`, are gone (prisma/orm#31218). The Supabase contract's storage and profile hash literals also take the values this release's hash rules give the same contract (ADR 332)."}
- {"path":"./runtime","export":"SupabaseInternalDb","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"927d50a8cf68b4ae","reason":"The Supabase contract's capabilities are the ones it requires; the `postgres` flags this release retired, such as `jsonAgg`, are gone (prisma/orm#31218)."}

@prisma/orm-extension-supabase

+ (not exported) type ProfileHash = ProfileHashBase<'18654d8be351e94d940c57892ee3d3b92824fc145d7dd67c5f57168eea52c619'>
- (not exported) type ProfileHash = ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>
- (not exported) type StorageHash = StorageHashBase<'110ad99e1e466691bdb0a4349a17365561e76ad017f58beb272f4496b05b8e9e'>
+ (not exported) type StorageHash = StorageHashBase<'8278c3368c71bbeafa93f945c79d42f738b19480ba8a51472b02dd429a9f09f2'>

packages/9-public/@prisma/orm-family-mongo/api-breaks.json

+ {"path":"./contract/canonicalization-hooks","export":"*","test":"path","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Renamed to `contract/normal-form`: the module now holds the family's normal form of storage, which also leaves out the family's defaults, not only hash hooks (ADR 010)."}
+ {"path":"./family","export":"MongoContractSerializer","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"ac62faf8791a8e7c","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family","export":"MongoContractSerializer","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"ac62faf8791a8e7c","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family","export":"MongoContractSerializerBase","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"876ba42b3c806714","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family","export":"MongoContractSerializerBase","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"876ba42b3c806714","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family/ir","export":"MongoContractSerializer","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"ac62faf8791a8e7c","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family/ir","export":"MongoContractSerializer","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"ac62faf8791a8e7c","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family/ir","export":"MongoContractSerializerBase","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"876ba42b3c806714","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family/ir","export":"MongoContractSerializerBase","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"876ba42b3c806714","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}

@prisma/orm-family-mongo

- ./contract/canonicalization-hooks: const mongoContractCanonicalizationHooks: { readonly shouldPreserveEmpty: PreserveEmptyPredicate; }
+ ./contract/normal-form: const normalizeMongoStorage: NormalizeStorage
+ ./contract/normal-form: function normalizeMongoDomain(domain: unknown): unknown
+ ./family/ir: class MongoContractSerializerBase, readonly required property normalizeStorage: NormalizeStorage
- ./family/ir: class MongoContractSerializerBase, required property shouldPreserveEmpty: PreserveEmptyPredicate
+ ./family: class MongoContractSerializerBase, readonly required property normalizeStorage: NormalizeStorage
- ./family: class MongoContractSerializerBase, required property shouldPreserveEmpty: PreserveEmptyPredicate

packages/9-public/@prisma/orm-family-sql/api-breaks.json

+ {"path":"./contract","export":"sqlContractCanonicalizationHooks","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/canonicalization-hooks","export":"*","test":"path","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Renamed to `contract/normal-form`: the module now holds the family's normal form of storage, which also leaves out the family's defaults, not only hash hooks (ADR 010)."}
+ {"path":"./family","export":"SqlContractSerializer","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"8f554f25f6bc0827","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family","export":"SqlContractSerializer","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"8f554f25f6bc0827","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family","export":"SqlContractSerializerBase","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"81aac9dfdd5fb63f","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family","export":"SqlContractSerializerBase","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"81aac9dfdd5fb63f","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family/ir","export":"SqlContractSerializer","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"8f554f25f6bc0827","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family/ir","export":"SqlContractSerializer","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"8f554f25f6bc0827","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family/ir","export":"SqlContractSerializerBase","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"81aac9dfdd5fb63f","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./family/ir","export":"SqlContractSerializerBase","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"81aac9dfdd5fb63f","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}

@prisma/orm-family-sql

- ./contract/canonicalization-hooks: const sqlContractCanonicalizationHooks: { readonly shouldPreserveEmpty: PreserveEmptyPredicate; readonly sortStorage: StorageSort; }
+ ./contract/normal-form: const normalizeSqlStorage: NormalizeStorage
+ ./contract/normal-form: function normalizeSqlDomain(domain: unknown): unknown
+ ./contract: const normalizeSqlStorage: NormalizeStorage
- ./contract: const sqlContractCanonicalizationHooks: { readonly shouldPreserveEmpty: PreserveEmptyPredicate; readonly sortStorage: StorageSort; }
+ ./contract: function normalizeSqlDomain(domain: unknown): unknown
+ ./family/ir: class SqlContractSerializerBase, readonly required property normalizeStorage: NormalizeStorage
- ./family/ir: class SqlContractSerializerBase, required property hashCanonicalizationHooks: { readonly shouldPreserveEmpty: PreserveEmptyPredicate; readonly sortStorage: StorageSort; }
- ./family/ir: class SqlContractSerializerBase, required property shouldPreserveEmpty: PreserveEmptyPredicate
- ./family/ir: class SqlContractSerializerBase, required property sortStorage: StorageSort
+ ./family: class SqlContractSerializerBase, readonly required property normalizeStorage: NormalizeStorage
- ./family: class SqlContractSerializerBase, required property hashCanonicalizationHooks: { readonly shouldPreserveEmpty: PreserveEmptyPredicate; readonly sortStorage: StorageSort; }
- ./family: class SqlContractSerializerBase, required property shouldPreserveEmpty: PreserveEmptyPredicate
- ./family: class SqlContractSerializerBase, required property sortStorage: StorageSort

packages/9-public/@prisma/orm-framework/api-breaks.json

+ {"path":"./components","export":"ControlAdapterDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"2cf06ed9c7f8477c","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components","export":"ControlAdapterDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"440a3ed32050305a","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components","export":"ControlFamilyDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"2cf06ed9c7f8477c","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components","export":"ControlFamilyDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"440a3ed32050305a","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components","export":"ControlStack","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"2cf06ed9c7f8477c","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components","export":"ControlStack","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"440a3ed32050305a","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
- {"path":"./components","export":"CreateControlStackInput","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"619b059c1de8c793","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components","export":"CreateControlStackInput","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"d2fcc4055d632764","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components","export":"MigratableTargetDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"5f8a3328df3f7562","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components","export":"MigratableTargetDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"eea1681330bf07aa","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). A target's contract serializer also supplies the required `normalizeStorage`, the family's normal form of storage, which the framework applies when it writes and when it hashes (ADR 010, ADR 332)."}
- {"path":"./components","export":"createControlStack","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"580079d42905baee","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components","export":"createControlStack","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"64995d1d37bedaf9","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components","export":"hasMigrations","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"1259e5e8248767aa","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components","export":"hasMigrations","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"657546d043dabb0d","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./components/control","export":"ControlAdapterDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"2cf06ed9c7f8477c","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components/control","export":"ControlAdapterDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"440a3ed32050305a","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components/control","export":"ControlFamilyDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"2cf06ed9c7f8477c","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components/control","export":"ControlFamilyDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"440a3ed32050305a","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components/control","export":"ControlStack","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"2cf06ed9c7f8477c","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components/control","export":"ControlStack","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"440a3ed32050305a","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
- {"path":"./components/control","export":"CreateControlStackInput","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"619b059c1de8c793","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components/control","export":"CreateControlStackInput","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"d2fcc4055d632764","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components/control","export":"MigratableTargetDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"5f8a3328df3f7562","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components/control","export":"MigratableTargetDescriptor","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"eea1681330bf07aa","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). A target's contract serializer also supplies the required `normalizeStorage`, the family's normal form of storage, which the framework applies when it writes and when it hashes (ADR 010, ADR 332)."}
- {"path":"./components/control","export":"createControlStack","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"580079d42905baee","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components/control","export":"createControlStack","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"64995d1d37bedaf9","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./components/control","export":"hasMigrations","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"1259e5e8248767aa","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./components/control","export":"hasMigrations","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"657546d043dabb0d","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./config","export":"PrismaConfig","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"1e6e821151f5b892","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./config","export":"PrismaConfig","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"21ba537b3e284905","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./config","export":"defineConfig","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"232d35def51952fa","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./config","export":"defineConfig","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"ce24738f65287bec","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./config/config-types","export":"PrismaConfig","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"1e6e821151f5b892","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./config/config-types","export":"PrismaConfig","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"21ba537b3e284905","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./config/config-types","export":"defineConfig","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"232d35def51952fa","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218). Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
- {"path":"./config/config-types","export":"defineConfig","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"ce24738f65287bec","reason":"A schema difference's cause can now be `database-capabilities-not-provided`, for a database that lacks a capability the contract requires (prisma/orm#31218)."}
+ {"path":"./contract","export":"PathPattern","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"PreserveEmptyPathSegment","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"PreserveEmptyPredicate","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"StorageSort","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"canonicalizeContract","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"37d9777fda7750c0","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./contract","export":"canonicalizeContractToObject","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"9a37899c51e8529f","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./contract","export":"computeStorageHash","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"fb2de15d92e3a7a2","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./contract","export":"createPreserveEmptyPredicate","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"matchesPathPattern","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing","export":"PreserveEmptyPredicate","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing","export":"StorageSort","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing","export":"canonicalizeContract","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"37d9777fda7750c0","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./contract/hashing","export":"canonicalizeContractToObject","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"9a37899c51e8529f","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./contract/hashing","export":"computeStorageHash","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"fb2de15d92e3a7a2","reason":"Each family now supplies its normal form of storage as a required `normalizeStorage`, which the framework applies when it writes and when it hashes; the framework's canonicalizer no longer leaves out defaults or empty values by path, so the earlier hooks are gone (ADR 010, ADR 332)."}
+ {"path":"./contract/hashing-utils","export":"PathPattern","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing-utils","export":"PreserveEmptyPathSegment","test":"type","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing-utils","export":"createPreserveEmptyPredicate","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing-utils","export":"matchesPathPattern","test":"value","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}

@prisma/orm-framework

+ (not exported) type ComputeStorageHashArgs = { target: string; targetFamily: string; storage: Record<string, unknown>; readonly normalizeStorage: NormalizeStorage; }
- (not exported) type ComputeStorageHashArgs = { target: string; targetFamily: string; storage: Record<string, unknown>; readonly shouldPreserveEmpty?: PreserveEmptyPredicate; readonly sortStorage?: StorageSort; }
- ./components/control: interface ContractSerializer, readonly optional property hashCanonicalizationHooks?: { readonly shouldPreserveEmpty?: PreserveEmptyPredicate; readonly sortStorage?: StorageSort; }
- ./components/control: interface ContractSerializer, readonly optional property shouldPreserveEmpty?: PreserveEmptyPredicate
- ./components/control: interface ContractSerializer, readonly optional property sortStorage?: StorageSort
+ ./components/control: interface ContractSerializer, readonly required property normalizeStorage: NormalizeStorage
- ./components: interface ContractSerializer, readonly optional property hashCanonicalizationHooks?: { readonly shouldPreserveEmpty?: PreserveEmptyPredicate; readonly sortStorage?: StorageSort; }
- ./components: interface ContractSerializer, readonly optional property shouldPreserveEmpty?: PreserveEmptyPredicate
- ./components: interface ContractSerializer, readonly optional property sortStorage?: StorageSort
+ ./components: interface ContractSerializer, readonly required property normalizeStorage: NormalizeStorage
- ./contract/hashing-utils: function createPreserveEmptyPredicate(patterns: readonly PathPattern[]): PreserveEmptyPredicate
+ ./contract/hashing-utils: function createStorageSort(targets: readonly NamedArraySortTarget[], compare?: (a: unknown, b: unknown) => number): NormalizeStorage
- ./contract/hashing-utils: function createStorageSort(targets: readonly NamedArraySortTarget[], compare?: (a: unknown, b: unknown) => number): StorageSort
- ./contract/hashing-utils: function matchesPathPattern(path: readonly string[], pattern: PathPattern): boolean
- ./contract/hashing-utils: type PathPattern = readonly PreserveEmptyPathSegment[]
- ./contract/hashing-utils: type PreserveEmptyPathSegment = '*' | readonly string[] | string
+ ./contract/hashing: function assertContractHashes(options: AssertContractHashesOptions): void
+ ./contract/hashing: interface AssertContractHashesOptions
+ ./contract/hashing: interface AssertContractHashesOptions, readonly required property contracts: readonly SavedContractHashes[]
+ ./contract/hashing: interface AssertContractHashesOptions, readonly required property normalizeStorage: NormalizeStorage
- ./contract/hashing: interface CanonicalizeContractOptions, readonly optional property shouldPreserveEmpty?: PreserveEmptyPredicate
- ./contract/hashing: interface CanonicalizeContractOptions, readonly optional property sortStorage?: StorageSort
+ ./contract/hashing: interface CanonicalizeContractOptions, readonly required property normalizeStorage: NormalizeStorage
+ ./contract/hashing: interface HashedContractSections
+ ./contract/hashing: interface HashedContractSections, readonly optional property execution?: Record<string, unknown>
+ ./contract/hashing: interface HashedContractSections, readonly required property capabilities: Record<string, Record<string, boolean>>
+ ./contract/hashing: interface HashedContractSections, readonly required property storage: Record<string, unknown>
+ ./contract/hashing: interface HashedContractSections, readonly required property target: string
+ ./contract/hashing: interface HashedContractSections, readonly required property targetFamily: string
+ ./contract/hashing: interface SavedContractHashes
+ ./contract/hashing: interface SavedContractHashes, readonly optional property executionHash?: string
+ ./contract/hashing: interface SavedContractHashes, readonly required property contract: HashedContractSections
+ ./contract/hashing: interface SavedContractHashes, readonly required property name: string
+ ./contract/hashing: interface SavedContractHashes, readonly required property profileHash: string
+ ./contract/hashing: interface SavedContractHashes, readonly required property storageHash: string
+ ./contract/hashing: type NormalizeStorage = (storage: unknown) => unknown
- ./contract/hashing: type PreserveEmptyPredicate = (path: readonly string[]) => boolean
- ./contract/hashing: type StorageSort = (storage: unknown) => unknown
+ ./contract: function assertContractHashes(options: AssertContractHashesOptions): void
- ./contract: function createPreserveEmptyPredicate(patterns: readonly PathPattern[]): PreserveEmptyPredicate
+ ./contract: function createStorageSort(targets: readonly NamedArraySortTarget[], compare?: (a: unknown, b: unknown) => number): NormalizeStorage
- ./contract: function createStorageSort(targets: readonly NamedArraySortTarget[], compare?: (a: unknown, b: unknown) => number): StorageSort
- ./contract: function matchesPathPattern(path: readonly string[], pattern: PathPattern): boolean
+ ./contract: interface AssertContractHashesOptions
+ ./contract: interface AssertContractHashesOptions, readonly required property contracts: readonly SavedContractHashes[]
+ ./contract: interface AssertContractHashesOptions, readonly required property normalizeStorage: NormalizeStorage
- ./contract: interface CanonicalizeContractOptions, readonly optional property shouldPreserveEmpty?: PreserveEmptyPredicate
- ./contract: interface CanonicalizeContractOptions, readonly optional property sortStorage?: StorageSort
+ ./contract: interface CanonicalizeContractOptions, readonly required property normalizeStorage: NormalizeStorage
+ ./contract: interface HashedContractSections
+ ./contract: interface HashedContractSections, readonly optional property execution?: Record<string, unknown>
+ ./contract: interface HashedContractSections, readonly required property capabilities: Record<string, Record<string, boolean>>
+ ./contract: interface HashedContractSections, readonly required property storage: Record<string, unknown>
+ ./contract: interface HashedContractSections, readonly required property target: string
+ ./contract: interface HashedContractSections, readonly required property targetFamily: string
+ ./contract: interface SavedContractHashes
+ ./contract: interface SavedContractHashes, readonly optional property executionHash?: string
+ ./contract: interface SavedContractHashes, readonly required property contract: HashedContractSections
+ ./contract: interface SavedContractHashes, readonly required property name: string
+ ./contract: interface SavedContractHashes, readonly required property profileHash: string
+ ./contract: interface SavedContractHashes, readonly required property storageHash: string
+ ./contract: type NormalizeStorage = (storage: unknown) => unknown
- ./contract: type PathPattern = readonly PreserveEmptyPathSegment[]
- ./contract: type PreserveEmptyPathSegment = '*' | readonly string[] | string
- ./contract: type PreserveEmptyPredicate = (path: readonly string[]) => boolean
- ./contract: type StorageSort = (storage: unknown) => unknown

packages/9-public/@prisma/orm-mariadb/api-breaks.json

+ {"path":"./contract","export":"PathPattern","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"PreserveEmptyPathSegment","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"PreserveEmptyPredicate","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"StorageSort","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"createPreserveEmptyPredicate","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"matchesPathPattern","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing","export":"PreserveEmptyPredicate","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing","export":"StorageSort","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing-utils","export":"PathPattern","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing-utils","export":"PreserveEmptyPathSegment","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing-utils","export":"createPreserveEmptyPredicate","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract/hashing-utils","export":"matchesPathPattern","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./family-contract","export":"sqlContractCanonicalizationHooks","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./family-contract/canonicalization-hooks","export":"*","test":"path","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Renamed to `contract/normal-form`: the module now holds the family's normal form of storage, which also leaves out the family's defaults, not only hash hooks (ADR 010)."}
+ {"path":"./migration-tools/contract-snapshot-store","export":"SnapshotCanonicalizationHooks","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}

@prisma/orm-mariadb

- ./family-contract/canonicalization-hooks: everything from @prisma/orm-family-sql/contract/canonicalization-hooks
+ ./family-contract/normal-form: everything from @prisma/orm-family-sql/contract/normal-form

packages/9-public/@prisma/orm-mongo/api-breaks.json

+ {"path":"./contract","export":"PathPattern","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"PreserveEmptyPathSegment","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"PreserveEmptyPredicate","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"StorageSort","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"createPreserveEmptyPredicate","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}
+ {"path":"./contract","export":"matchesPathPattern","test":"exists","kind":"break","lastRelease":"8.0.0-rc.25","fingerprint":"e3b0c44298fc1c14","reason":"Removed with the path patterns the framework used to leave out empty values: each family's `normalizeStorage` now names the defaults it leaves out, and `StorageSort` is renamed `NormalizeStorage` (ADR 010)."}

142 lines are left out here. The full list is in the job summary of the "API changes" check.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wmadden-electric wmadden-electric changed the title feat!: every contract hash changes once, to cover only its own part of the contract, and its rules are frozen for Prisma 8 feat!: correct the contract hash rules, then freeze them for Prisma 8 Nov 27, 2026
Base automatically changed from ga-compat-format-versions to main November 28, 2026 07:11
@wmadden-electric wmadden-electric mentioned this pull request Nov 28, 2026
feat(postgres)!: split Prisma's marker table into _prisma.signatures and _prisma.config #31242
Open
@wmadden-electric wmadden-electric changed the title feat!: correct the contract hash rules, then freeze them for Prisma 8 feat!: freeze the contract hash rules for Prisma 8, with each hash over its own section and no author value dropped Nov 28, 2026
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 28, 2026 08:37
@wmadden-electric @claude
feat!: freeze the contract hash rules for Prisma 8, with each hash ov…
5d97d2e
…er its own section and no author value dropped

Each hash covers targetFamily, target and its own section of the contract.
The framework canonicalizer drops no value; each family names the defaults
it leaves out in normalizeStorage. The SQL profile hash covers the
contract's capabilities, flags that are off left out. Foreign keys and
MongoDB indexes are sorted before hashing. assertContractHashes lets a
family or target hold its hashes fixed; prisma db sign gains --force. The
upgrade instructions and script move a release-candidate project to the
new hashes. ADR 332 records the decision and ADR 010 the computation.

Squashed from 312 commits so the sign-off check can read the pull
request; the earlier history is kept on ga-compat-hashes-backup-pre-squash.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wmadden-electric
wmadden-electric force-pushed the ga-compat-hashes branch from 4ed566f to 5d97d2e Compare November 28, 2026 09:02
wmadden-electric and others added 2 commits November 28, 2026 20:06
@wmadden-electric @claude
docs(adr-332, adr-010): rewrite to lead with the decision and a groun…
2a13f46
…ding example, and drop the one-time move from the pre-releases

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric @claude
docs(adr-332, adr-010): corrections from the fact check of the rewrite
e67cc8c
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-prisma__orm that referenced this pull request Nov 28, 2026
@wmadden-electric @claude
feat!: stored files carry a format version, and readers refuse what t…
5a526ee
…hey do not know (prisma#31200)

## At a glance

**The decision: every file Prisma stores in a project states the version
of its format, a reader refuses a version or a field it does not know,
and until `8.0.0` it still reads the files a release candidate wrote.**
`8.0.0` is the first stable release of Prisma 8, which has not shipped;
release candidates (`8.0.0-rc.N`) continue until then.

**Two things need the reviewer's decision:**

1. **This adds one concept to the framework domain,** which the
repository's rules reserve: the shared reader of a stored file's format
version, with its converters. It is there because some paths read a
contract before any family sees it. I recommend accepting it. Details
are under "API changes".
2. **Whether the framework should read a migration's operations strictly
when it loads them.** Today only the commands that act on a database do,
so `migration check` can pass a migration that `db migrate` refuses.
Fixing it adds a hook to the framework. I recommend adding it, in this
pull request or the next. Details are under "Known limits".

Suppose Prisma `8.3` changes how a migration is written, and a teammate
on `8.0` pulls a migration that `8.3` wrote. Without this pull request,
`8.0` could read it and apply only the part it understood. With it,
`8.0` stops before it touches the database (an example of the output):

```text
✘ [MIGRATION.FORMAT_VERSION_NEWER] The migration file (migration.json) "migrations/app/20270301_add_tags/migration.json" was written by a newer release of Prisma
  It is in format version 2, and this release of Prisma reads format version 1 only.
  Upgrade Prisma to the release that wrote the file, or a later one, and run the command again.
```

To make that possible, every file Prisma writes into a project and reads
back later starts with the version of its format:

```text
contract.json             before: { "schemaVersion": "1", "targetFamily": "sql", ... }
                          after:  { "formatVersion": 1,   "targetFamily": "sql", ... }
migration.json            before: { "from": "6c26…", "to": "6b46…", ... }
                          after:  { "formatVersion": 1, "from": "6c26…", "to": "6b46…", ... }
refs/production.json      before: { "hash": "6b46…", "invariants": [] }
                          after:  { "formatVersion": 1, "hash": "6b46…", "invariants": [] }
```

What it costs and what it does not:

- **A project a release candidate wrote keeps working with no step.**
Its files have no `formatVersion`. This release reads them as "format
version 0" and converts them in memory. Each file becomes version 1 the
next time a command writes it. `8.0.0` stops reading version 0, and a
script in the upgrade instructions rewrites the files before that
upgrade.
- **A file with a key Prisma does not define is now refused,** in a
contract, a migration, a ref or an operation. A hand-edited file with a
stray key stops reading. One exception until `8.0.0`: a ref file a
release candidate wrote is read with a stray key dropped, as the release
candidates did.
- **A MongoDB migration that passes `sort` or `returnDocument` to
`rawFindOneAndUpdate`, or `sort` to `rawFindOneAndDelete`, now sends
them to the database.** Earlier releases dropped them when they read the
migration back, so the command ran without them. Applying such a
migration to another database now does what its author wrote.
- **A SQL target built outside this repository must supply a new
function, `readOperations`,** and a contract serializer overrides a
different method. The full list is under "API changes".

About 600 of the changed files are the repository's own contracts,
snapshots, migrations and refs, rewritten by a script; each differs from
`main` only in the version field.

A **snapshot** is the copy of a contract that a migration keeps beside
it. A **ref** is a file that gives a contract a name, such as
`production`. `ops.json` holds the operations of a migration, beside its
`migration.json`.

## The decisions

All are recorded in a new decision record, [ADR
331](docs/architecture%20docs/adrs/ADR%20331%20-%20Stored%20files%20carry%20a%20format%20version%2C%20and%20a%20reader%20refuses%20one%20it%20does%20not%20know.md).

1. **`contract.json`, each snapshot, `migration.json` and each ref file
carry `formatVersion`.** A migration's version also covers its
`ops.json`.
2. **A reader looks at the version first.** A version it knows: it reads
the file. A higher version: it stops and says a newer release wrote the
file. No version: it stops and says how to get a file it can read,
unless the file is one only a release candidate wrote (decision 5).
3. **A reader refuses a field it does not know.** So a release cannot
add a field to a format without raising its version.
4. **A writer writes the oldest version that can hold the data,** so
newer tooling does not force an upgrade on everyone who reads its files.
With one version there is nothing to choose yet; the rule binds the
first release that adds a second.
5. **Until `8.0.0`, files a release candidate wrote are read as version
0 and converted in memory.** Until `8.0.0` the content of format 1 is
also not final: a release candidate may still change it, with upgrade
instructions.
6. **Format 1 of `ops.json` reads every shape of an operation that a
release candidate wrote, for the whole of Prisma 8.**

### Decisions 1 and 2: why the version and the refusal must be in
`8.0.0`

The Prisma 8 compatibility policy promises (its page is a draft,
prisma#31193; the promise itself is agreed) that a later 8.x release
reads every file an earlier one wrote, and the user regenerates nothing.
An `8.0.0` reader stays in use for the whole major. So it must already
know how to recognise a file it cannot read, and it must already refuse
what it does not understand. A reader that ignores an unknown key in
`8.0.0` will ignore, for the whole major, a field a later release adds.
Neither can be added afterwards.

A reader is strict because a migration is an instruction to change a
database. Acting on one that is only partly understood is the failure
the rule prevents.

### Decision 3: what "refuses a field it does not know" changed

Before this pull request several readers ignored unknown keys:

| Reader | Before | Now |
| --- | --- | --- |
| `migration.json` and ref files | A ref ignored unknown fields | Strict
in format 1; a release-candidate ref still has unknown fields dropped |
| Contract (SQL family, PostgreSQL entry kinds, MongoDB family) | About
25 kinds of object ignored an unknown key | Strict; the error names the
key's full path |
| MongoDB `ops.json` | Every object ignored an unknown key | Strict |
| SQL `ops.json` | No reader: the runners treated the parsed file as
operations | A strict reader in the SQL family, to which each SQL target
supplies its own fields |
| A type's parameters | Prisma's own types ignored an unknown parameter,
and no command checked them | Each of Prisma's 16 parameter schemas is
strict, and it is applied when a command reads a contract and when a
client builds the type |
| A contract snapshot | Read strictly only by `migration plan` | Read
strictly by whatever interprets it: planning, signing, `db migrate --to`
and `db update --to` for the snapshot a ref names, and `migration check`
for every snapshot a ref names or a graph ends at. A snapshot a command
only records or identifies by hash is not read |

A **family** is the code shared by databases of one kind (SQL, MongoDB);
a **target** is one database, such as PostgreSQL.

The rule stops at content Prisma carries for someone else, where any key
is accepted. These are the **open places**: `meta`, `capabilities`, an
extension's own section, a generator's parameters, a literal default's
value, an index's options, a SQL statement's parameters, and the MongoDB
documents handed to the database as they are. ADR 331 lists them.

SQL operations are read strictly by everything that acts on their
statements: the runners, the statement preview, and the checks `db
migrate` runs on a recorded path.

A command reads strictly what it interprets in that run, and no more.
`db migrate` records the snapshot of each migration it applies as it is
stored, and `migration status`, `list`, `graph` and `ref set` use hashes
only. This matters for old projects: one with a snapshot in a shape from
before `8.0.0-rc.1`, which no reader of this release reads, still
applies its migrations. The repository's telemetry app is such a
project.

A command that cannot read a stored file names it and says why, and
never calls it unknown or missing. It refuses when it acts on the file;
`migration list`, `graph`, `status` and `check` report it and go on with
the rest. `db update` is the one command that goes on past a file it
acts on: when the snapshot of the contract the database was last at
cannot be read, it warns and continues as for a database with no
recorded origin. Before this, several commands dropped such a file
without a word: `migration list` and `graph` left out a migration,
`migration new` started from the empty contract when its ref could not
be read, and `migration check` reported the migrations after an
unreadable one as unreachable, with advice to delete them. Every command
and entry point that loads a stored file was listed and checked for
this.

The advice a refusal gives follows one rule: restore the file from
version control first; name a command only where that command writes the
file again, and say what else it does; never give a new hash to a
migration a database has applied; never name a contract for the `db` ref
by hand. For example, a lost `migration.json` is written again by
running the migration's `migration.ts`, which gives it a new hash, so
that advice is offered only when no database has applied the migration.
The database commands warn about a migration whose snapshot they cannot
record only when the run applies it.

### Decision 5: why release-candidate files are read, and only until
`8.0.0`

Release-candidate users have asked for fewer forced rewrites. Reading
their files costs them nothing now. It also runs the "convert an earlier
format" path on real files before the first format change after `8.0.0`
depends on it.

A release-candidate file is recognised without guessing: a contract has
`"schemaVersion": "1"` and no `formatVersion`; a `migration.json` or ref
has neither. Only a release candidate wrote those. A contract with
neither field is refused, because no release wrote it. Version 0 has a
converter and no printer, so no release writes it. A test fails if a
release that is not a pre-release still reads version 0, so `8.0.0`
cannot ship with it.

prisma#31203, built on this pull request, changes how contract
hashes are computed. The parts of release-candidate reading that depend
on that are there.

### Decision 6: why older operation shapes are read for the whole major

From `8.0.0` no release may change a migration's hash, and `ops.json` is
covered by that hash. So from `8.0.0` an older shape of an operation can
only be read, never rewritten, and format 1 has to read it for the whole
major. Before `8.0.0` a script could still have rewritten those shapes,
because the hash rules change once before `8.0.0` (prisma#31203).
Reading them was chosen because it is small and costs users no step. The
reader converts each to the current shape before it checks the
operation, so nothing after it sees the older form:

- **SQLite, up to `8.0.0-rc.19`:** every operation carried `"schema":
"main"`. It is dropped. Any other value is refused.
- **PostgreSQL and SQLite, `8.0.0-rc.21` and `rc.22`:** an entry in a
step's `meta` tells the runner to count the rows that still hold a
removed enum value. In those releases it had fewer fields. The reader
fills them in from the same places those releases' runners read them.
- **MongoDB:** a field the query builder writes into a query plan is
declared, and two command options that earlier readers dropped, `sort`
and `returnDocument` on `rawFindOneAndUpdate` and `sort` on
`rawFindOneAndDelete`, are now passed to the command. That changes what
such a migration does when it is applied again: it now does what its
author wrote.

These were found by going through the history of every planner,
operation class and serializer across all 485 published `8.0.0-rc` tags
(each release candidate and the development builds between them),
because the repository holds no saved file of most of them. Contract
shapes from earlier release candidates need no such acceptance:
published upgrade instructions already rewrite them.

## Known limits

Recorded in the project's follow-up list,
`projects/ga-compat-stored-files/deferred.md`:

- **`migration check`, `status`, `list` and `graph` do not read a
target's own operation fields.** They load `ops.json` in the framework
and use only the fields every target shares. So `migration check` can
pass a migration that `db migrate` refuses. Fixing it means the
framework asks the family to read each operation when it loads the file,
which adds to the framework. It is listed in ADR 331 as an alternative
not chosen here, and it is the second decision asked of the reviewer
above.
- **A migration written in code can write an operation that `db migrate`
then refuses,** for the same reason.
- **An index's `type` and `options` are not checked when a contract is
read,** only by the TypeScript builder.
- **SQLite creates an empty database file when `db migrate` refuses a
migration,** because the refusal comes after the database is opened to
read its marker. That was so before this change.
- **Nothing tests that the open places stay open.** A reader that starts
acting on a key inside one needs a new format version, and only the
author of the change knows.

## For users of a release candidate

Nothing to do for this change. [The upgrade
instructions](upgrade-instructions/pending/stored-files-format-version/app/instructions.md),
for applications and for extensions, still ship a script that rewrites
every file to version 1. It is required before upgrading to `8.0.0`, and
optional until then:

```bash
node upgrade-instructions/pending/stored-files-format-version/app/scripts/stored-files-format-version/stored-files-format-version.ts
```

That is its path in this repository. A user gets it with the release's
upgrade guide in the Prisma 8 skill and runs it from their project root.

It renames `schemaVersion` in every contract and snapshot, adds
`formatVersion` to every `migration.json` and ref file, changes no other
byte and no hash, removes an unknown field from a ref file and lists it,
and changes nothing when run again.

## API changes

Application code changes nothing. The changes are for authors of a
family, a target, an extension or a tool built on the toolchain.

- `@prisma/orm-framework`: new entries `contract/format-version`
(`convertContractDocument`, which reads a stored contract's version and
converts an earlier one; `NEWEST_CONTRACT_FORMAT_VERSION`, which a
family writes into the contracts it prints; `isFormatVersionError`; and
their types), so a family built outside this repository reads and writes
a contract the way Prisma does (the same names are also on the
`contract` entry); `contract/internal/format-version`, the shared reader
and its converters for every kind of file (`readStoredDocument`,
`StoredFormat` and their types), which Prisma's own packages reach each
other through and which is not for outside code; and
`utils/upgrade-guides`, the addresses a refusal points to.
`CanonicalizeContractOptions` loses `schemaVersion`, because
`canonicalizeContract` no longer takes or writes it.
`errorContractValidationFailed` accepts the file's path and what kind of
file it is in its options, so a refused contract or snapshot names its
file.
- `@prisma/orm-postgres`, `@prisma/orm-mysql`, `@prisma/orm-mariadb`,
`@prisma/orm-sqlite` and `@prisma/orm-mongo`: each re-exports the three
new framework entries, because a database package re-exports every
framework entry so that code built on it needs no direct dependency on
the framework. That includes the `internal` entry, which Prisma's own
packages use to reach each other and which is not for outside code.
- `@prisma/orm-family-sql`: `SqlContractSerializerBase` gains protected
`parseContractV1` and `printContractV1`, the parser and printer of
contract format 1; the base class reads and writes the version around
them. New: `createSqlOperationsReader`, `SqlOperationsReader`,
`SqlTargetOperationsFormat` and `SqlOperationsLocation`, the strict
reader of SQL operations and what a target supplies to it; and
`probeUnknownKeys`, `SQL_OPERATIONS_OPEN_PLACES`, `DocumentPlace` and
`UnknownKeyProbe`, a test helper with which a SQL target's author checks
that its reader refuses an unknown key everywhere outside the open
places. `SqlControlTargetDescriptor` gains a required `readOperations`,
so **a SQL target built outside this repository must now supply it**.
Its `api-breaks.json` records the breaks against `8.0.0-rc.25`.
- `@prisma/orm-family-mongo`: `MongoContractSerializerBase` and
`MongoContractSerializer` gain `parseContractV1` and `printContractV1`,
for the same reason as the SQL base.
- `@prisma/orm-target-postgres`: `PostgresContractSerializer` overrides
`printContractV1` where it overrode `serializeContract`, because the
base class now writes the version around it.
- `@prisma/orm-target-mysql`: `MysqlContractSerializer` overrides
`printContractV1` for the same reason, and the target supplies
`readOperations`. Its `api-breaks.json` records the breaks.
- `@prisma/orm-target-sqlite`: `SqliteContractSerializer` overrides
`printContractV1` for the same reason.
- `@prisma/orm-target-mongo`: `MongoTargetContractSerializer` overrides
`printContractV1` for the same reason. `deserializeMongoOps` takes an
optional `MongoOperationsLocation`, so a refusal names the migration and
the operation.
- `@prisma/orm-toolchain`: new `parseMigrationMetadataDocument`,
`printMigrationMetadataDocument`, `parseRefDocument`, `printRefDocument`
and their document types, the parser and printer of each version of
`migration.json` and ref files. `computeMigrationHash` accepts
`formatVersion` and leaves it out of the hash. `contractSpaceFromJson`
requires `spaceId`, so an error in a file an extension ships names the
extension. `assertDescriptorSelfConsistency` takes the whole
`contractJson`, so it can read the version first. `buildReadAggregate`
gains `onUnreadableFile`, which refuses an unreadable ref or migration
by default and lets a listing command report it and keep going.
`IntegrityViolation`'s `contractUnreadable` gains the snapshot's `hash`,
so a refusal names the file; the functions that carry that type are
recorded as breaks for it. `DbUpdateOptions` gains an optional
`onUnreadableOrigin`. `enumerateCheckSpaces` takes one options object
(`EnumerateCheckSpacesInputs`) with the family's contract reader, and
`CheckSpace` carries that reader and the migrations that could not be
read; `checkSingleTarget` and `runMigrationCheck` follow. Its
`api-breaks.json` records these. The breaks recorded against
`8.0.0-rc.25` are `contractSpaceFromJson`,
`assertDescriptorSelfConsistency`, `buildReadAggregate`,
`enumerateCheckSpaces`, `checkSingleTarget` and `runMigrationCheck`.

The repository's rule is that the framework domain,
`packages/1-framework`, gains no new concepts. This pull request adds
one there (the first decision asked of the reviewer above): the shared
reader of a stored file's format version, with its converters. It is in
the framework because some paths read a contract before any family sees
it (the CLI's contract reader, the snapshot store, an extension's
bundled files). The strict readers added nothing to the framework. This
addition needs the reviewer's agreement.

## Reviewing the diff

<details>
<summary>A suggested reading order</summary>

1. ADR 331.
2. `packages/1-framework/0-foundation/contract/src/format-version.ts`:
the shared reader, the refusals and their advice, version 0.
3. `packages/1-framework/3-tooling/migration/src/formats/`: one unit per
version of `migration.json` and ref files.
4. Each family's contract serializer base, and the strict contract
validators (`packages/2-sql-family/1-core/contract/src/validators.ts`,
`packages/2-mongo-family/1-foundation/mongo-contract/src/contract-schema.ts`).
5. The SQL operations reader,
`packages/2-sql-family/9-family/src/core/migrations/operations-reader.ts`,
and each SQL target's `read-operations.ts`.
6. The MongoDB operations reader,
`packages/3-targets/mongo/1-target/src/core/migrations/mongo-ops-serializer.ts`.
7. The upgrade instructions and script, with tests in
`test/integration/test/upgrade-instructions/stored-files-format-version/`.

</details>

## How it was verified

- **Each parser and printer:** print, parse, same data back. Each
refusal and each reading path has a test.
- **Strictness:** for each object made strict, a test adds one unknown
key and expects a refusal that names its path. A one-off probe added an
unknown key at every place in the 368 saved contracts that read: 403
distinct places accepted it before, and only the open places do now. A
committed test does the same for every saved SQL `ops.json` of each
target.
- **Nothing saved stops reading:** tests read every saved
`contract.json` and every saved SQL and MongoDB `ops.json`, and fail on
an empty list. They exclude, by name, 46 contracts in shapes from before
`8.0.0-rc.1`, which the published `rc.25` reader refuses too, and the
fixtures of earlier upgrade scripts. Stored contracts under other file
names (112, mostly expected-output files of tests) are not in that test;
a one-off run read all but one deliberate "before" fixture.
- **Older shapes:** each one reads and gives the current shape; a
malformed one is refused. For the enum-value mark, the conversion was
checked against the `rc.22` runner's code.
- **Release-candidate files:** a PostgreSQL and a MongoDB project that
`8.0.0-rc.25` wrote are read file by file. The three tests on `main`
that give an `rc.25` contract to a client pass.
- **The script:** `before` and `after` project trees, a second run, and
files it must refuse.
- **By hand, with the built CLI, on real `8.0.0-rc.25` PostgreSQL and
MongoDB projects with no script run:** `contract emit`, `migration
status`, `migration check`, `migration plan` of a change, `db migrate`,
`db verify` and a query worked, and only the files the commands wrote
moved to version 1.
- **By hand, strictness:** an unknown key was planted in each kind of
stored file and each kind of place, for both databases. Every strict
place refused it, every open place accepted it, the refusal's advice
worked when followed, and no file or database changed. A file at version
2 was refused by every command. The first run found two gaps (a snapshot
and a column's type parameters were accepted) and three commands that
hid or misreported an unreadable file. They are fixed and the fixes
confirmed by hand. One fix first went too far, reading every recorded
snapshot strictly, which stopped the telemetry app migrating an empty
database; review caught it and it was narrowed.
- **By hand, older shapes:** a migration with the older enum-value mark
was applied to a real PostgreSQL database, with and without a row
holding the value, with the same result and messages as the current
shape. On SQLite, `"schema": "main"` applied and `"schema": "other"` was
refused. On MongoDB, the `sort` of a raw command decided which document
changed.
- **By hand, repair advice:** every command a refusal advises was run on
copies of PostgreSQL and MongoDB projects, in the application's space
and an extension's, with and without `--db` and `--config`, and the
project checked afterwards with `migration check` and `db migrate`. Four
review rounds found advice that refused, had side effects it did not
state, or changed a hash; the last round fixed six such findings, and a
final check covered only those six.
- **The merge queue's integration tests** found that the new read-time
check of type parameters reported a refused `varchar(0)` as a generic
"contract validation failed". It now reports the data type's own
`CONTRACT.TYPE_PARAMS_INVALID`, as main did. The CLI passes that error
through as itself, alongside the format version errors. That is a list
of codes chosen by name, not a rule for every library error: these are
the read errors whose own message tells the user what to change, where
the generic wrapper's advice (emit again) would not help. The commands
that only list migrations still report it and go on.
- **Decision record:** reviewed by fresh agents under the repository's
rule for documentation: a cold reader, three times, and a fact checker
against the code, five times, with its last findings corrected.
- **CI** runs on this branch. The whole package, integration and
end-to-end suites were not run locally.
- **Independent review,** design and code separately, on each part, in
several rounds.

## Alternatives considered

- **Refuse a release-candidate file and leave it to the upgrade
script.** Rejected while release candidates continue: every user would
rewrite every stored file for a change that adds one field, and the
conversion path would first run on real files only after `8.0.0`.
- **Read a file with no version as version 1, with no "version 0".**
Rejected: a reader that assumes a version is what the opening example
shows going wrong. Version 0 is recognised by what only a release
candidate wrote, and it has an end date.
- **Ignore fields a reader does not know,** as Protocol Buffers readers
do. Rejected: Prisma would apply a migration while ignoring part of it.
- **Let each new field say whether an older release may ignore it.**
Rejected: someone would have to judge that correctly for every field
ever added. Writing the oldest version that holds the data serves the
same case.
- **Rewrite an older operation shape with an upgrade script.** Possible
before `8.0.0` and not chosen: reading the shapes is small and costs
users no step. From `8.0.0` it is not possible, because a migration's
hash may not change.
- **Read operations strictly when the framework loads `ops.json`.** Not
chosen here, because it adds to the framework. See "Known limits".
- **Record which Prisma release wrote the file.** Rejected: most
releases change no format, so a release number would refuse files an
older release reads perfectly well.
- **A version string such as `"1.2"`.** Rejected: a reader refuses any
version it does not know, so there is no compatible minor step to
express.
- **A version only in `contract.json`, or one for the whole project.**
Rejected: migrations and refs are read on their own, and the files
change independently.
- **A version inside `ops.json`, by wrapping the array in an object.**
Rejected: it would change every migration's hash, and `ops.json` is
never read without its `migration.json`.
- **Include `formatVersion` in the migration hash.** Rejected:
converting a migration to a later format would change its hash.
- **Tell a stored file from a contract Prisma built in memory by which
fields it has.** A command accepts either. Rejected: a file with no
version field at all would be taken for a built contract and accepted.

Agent: alexvanhalen-55

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Fable 5.2 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@wmadden-electric
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.