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 — TML-3537: Changing a value object or a variant is a migration, and Postgres checks value object and discriminator columns by wmadden-electric · Pull Request #30869 · prisma/orm

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Linked issue

Refs TML-3537. This is the third of four pull requests for the remaining migration statements. The first two (namespaces, enum values) are merged. The fourth adds the value object and variant statements on top of this one.

At a glance

A model stores a value object in one jsonb column:

type Address {
  street String
  city   String
}

model User {
  id      Int      @id
  address Address?
  @@map("user")
}

Before this change, contract.json kept Address in the domain plane, and the field named it:

"domain": { "namespaces": { "public": {
  "models": { "User": { "fields": {
    "address": { "nullable": true, "type": { "kind": "valueObject", "name": "Address" } }
  } } },
  "valueObjects": { "Address": { "fields": {
    "city":   { "nullable": false, "type": { "kind": "scalar", "codecId": "pg/text@1" } },
    "street": { "nullable": false, "type": { "kind": "scalar", "codecId": "pg/text@1" } }
  } } }
} } }

Now Address is a storage entity, and the field refers to it by its storage coordinate:

"domain": { "namespaces": { "public": { "models": { "User": { "fields": {
  "address": { "nullable": true, "type": { "kind": "valueObject", "plane": "storage", "namespaceId": "public", "entityKind": "valueObject", "entityName": "Address" } }
} } } } } },
"storage": { "namespaces": { "public": { "entries": { "valueObject": { "Address": { "fields": {
  "city":   { "nullable": false, "type": { "kind": "scalar", "codecId": "pg/text@1" } },
  "street": { "nullable": false, "type": { "kind": "scalar", "codecId": "pg/text@1" } }
} } } } } } }

On a managed Postgres table, the column gets a derived check. migration plan writes it:

CONSTRAINT "user_address_shape_<hash>" CHECK ("address" IS NULL OR jsonb_path_match("address", 'strict $.type() == "null" || ($.type() == "object"
  && exists($.keyvalue() ? (@.key == "city" && (@.value.type() == "string")))
  && exists($.keyvalue() ? (@.key == "street" && (@.value.type() == "string")))
  && !exists($.keyvalue() ? (@.key != "city" && @.key != "street")))') IS TRUE)

Before, renaming street changed only the domain plane. The storage hash stayed the same, and migration plan reported "No changes detected" while every row kept the old key. Now the rename changes the storage hash and the check, so the migration system sees it.

Summary

The migration system tells database states apart by the storage hash. A value object's fields and a discriminator's values are stored data, so they now live in storage, where the hash covers them. The decision is recorded in ADR 309.

Decision

This PR ships four things:

  1. Value objects are storage entities, in both the SQL and MongoDB families, at storage.namespaces.<ns>.entries.valueObject.<Name>, with the definition they had in the domain plane. A domain field refers to one by storage coordinate. This is the first reference from the domain plane to the storage plane. A contract that still keeps valueObjects in the domain is refused with a message that says to re-emit it.
  2. A SQL discriminator column names a value set. The build writes one value set per base model with variants, keyed <Base>.<field> (for example Task.type), holding the variants' values sorted. The base table's discriminator column refers to it, as an enum column refers to its enum's value set. MongoDB writes none, because its collection validator already lists each variant's value.
  3. Postgres derives two checks on a managed table: <table>_<column>_shape_<hash> for a value object column, and <table>_<column>_check_<hash> for a discriminator column ("type" IN ('bug', 'feature')). The checks are content-named, so any change to the value object or the variants drops the old check and adds the new one.
  4. A plan whose storage hash changed but has no operations is written and applied. migration plan writes the migration with no operations and names what changed. db migrate and db update move the marker to the new hash. Before, such a plan was refused.

Every contract with value objects or variants is re-emitted, and the prisma-8-demo initial migration now creates the two checks. Projects upgrade with a script.

Reviewer notes

  • Most of the diff is re-emitted fixtures. Every committed contract with value objects or variants, its contract.d.ts and the example migration snapshots changed hash. pnpm fixtures:check is clean. The source changes are in the families' authoring, emit, ORM and validator code, the Postgres check derivation and the CLI's no-operation plan.
  • The value object check is one jsonpath predicate, ending in IS TRUE, so an unknown result fails. A required member must be present and of its codec's JSON type, a nullable member may be absent or JSON null, and no other key is allowed. A value object that contains itself is checked down to where it refers back to itself, as the MongoDB validator does.
  • Each Postgres codec declares the JSON type its value is written as, in a new jsonType field ('string' | 'number' | 'boolean' | 'object' | 'array' | 'any'), as MongoDB data types declare bsonTypes. The check reads it. TypeScript requires the field. At run time a codec package built before this release still loads; only a value object member that uses such a codec is refused, with CONTRACT.CODEC_JSON_TYPE_MISSING, naming the codec and the member.
  • SQL value objects hold no unions or dictionaries. No SQL authoring surface writes one, and the check cannot enforce one, so a hand-written SQL contract with one is refused when it is validated.
  • The framework now defines the valueObject storage entity kind, with one schema both families use, because domain fields refer to it. ADR 221 says families and packs own entity kinds, so ADR 309 and a note in ADR 221 record the exception.
  • A clash between an enum's value set and a discriminator's is refused. It needs an enum named exactly like <Base>.<field> in the same namespace. No authoring surface writes that name, so only a hand-written definition reaches the refusal.
  • The SQL TypeScript builder has no value objects. The main SQL ORM test contract used to patch one into its built contract, which left its storage hash stale. It now stores User.address as plain jsonb, and the value object type tests read a new PSL fixture. This is recorded in projects/migration-statements/deferred.md.
  • The mongo-demo and retail-store migration chains fail db migrate on mongodb-memory-server with MIGRATION.SCHEMA_VERIFY_FAILED. They fail the same way on origin/main, so this PR did not cause it. Filed as TML-3749.

How it fits together

  1. Contract shape and validation. The framework contract types gain the storage value object and the field's storage coordinate. Both families' validators check that each coordinate resolves to a storage entry, and that a value object member's enum refers to a storage value set. See packages/1-framework/0-foundation/contract/src/domain-types.ts and packages/1-framework/0-foundation/contract/src/storage-value-objects.ts.
  2. Authoring writes storage. SQL PSL, MongoDB PSL, the MongoDB TypeScript builder and the Prisma 6 reader write value objects into storage before the storage hash is computed. SQL PSL now pairs each @@discriminator with its variants before the build, so the discriminator value set is in the hash. See packages/2-sql-family/2-authoring/contract-ts/src/build-contract.ts and packages/2-sql-family/2-authoring/contract-psl/src/interpreter.ts.
  3. Emit and types read storage. contract.d.ts types a value object field from the storage plane, through a new, required sixth parameter of FieldTypesFromDomain, so every contract.d.ts changes. A SQL discriminator field is typed by its variants' values ('bug' | 'feature'). See packages/1-framework/0-foundation/contract/src/field-value-types.ts.
  4. Runtime and tools follow the reference. The SQL and MongoDB ORMs and query builders, the MongoDB validator derivation, contract print, contract infer and the statement resolver find a value object through the field's coordinate.
  5. Postgres derives the checks, from the storage value object and the discriminator value set. The SQL family resolves each value object and its members' JSON types once, and the build and contract print share that derivation. See packages/2-sql-family/1-core/contract/src/check-expressions.ts and packages/3-targets/postgres/1-target/src/core/check-expressions.ts.
  6. The CLI writes and applies a plan with no operations when the storage hash changed, and names the storage entities that changed (changedStorageEntities in --json). When rows break a new check, the runner reports which check and column, and the CLI gives the query that finds the rows and the way to keep their data. See packages/1-framework/3-tooling/cli/src/control-api/operations/migration-plan.ts and packages/1-framework/3-tooling/cli/src/utils/runner-failure-advice.ts.

Behavior changes & evidence

  • A value object column on a managed Postgres table is checked. A row the ORM writes is accepted. A row with an undeclared key or a missing member is refused, naming the check. Evidence: test/integration/test/cli-journeys/value-object-checks.e2e.test.ts (V1), packages/3-targets/postgres/1-target/test/check-expressions.value-object.test.ts.
  • Changing a value object is a migration. Adding a member, or making one nullable, drops the old check and adds the new one; rows that fit the new shape stay. Adding a required member to a table with a row that lacks it fails at apply and changes nothing. The error names the check and the column, gives the query that finds the rows, and says how to keep their data: an update in migration.ts between the drop of the old check and the add of the new one. Following that advice applies cleanly. Evidence: value-object-checks.e2e.test.ts (V2, V3).
  • Adding a variant replaces the discriminator check, and the new variant's value is accepted. Evidence: value-object-checks.e2e.test.ts (V4).
  • A storage change with no operation is written and applied. Changing a value object that only an external table's column holds writes a migration with no operations, and migrate moves the marker. Evidence: value-object-checks.e2e.test.ts (V5), test/integration/test/cli-journeys/plans-with-no-operations.e2e.test.ts and its SQLite and MongoDB twins.
  • On MongoDB, a value object change still updates the collection validator. Evidence: test/integration/test/cli-journeys/value-object-validator.mongo.e2e.test.ts.
  • A contract with valueObjects in the domain is refused with CONTRACT.VALIDATION_FAILED, saying to re-emit it. Evidence: packages/1-framework/0-foundation/contract/test/validate-domain.test.ts.

Every journey runs through migration plan and migrate, and through db update, and ends with db verify --schema-only clean and a further plan empty.

Upgrade

The upgrade instructions are in upgrade-instructions/pending/value-objects-in-storage/. For an app:

  1. Apply every pending migration to each database with the release you are upgrading from, and commit your work.
  2. Upgrade the Prisma packages to this release.
  3. Run the script from the project root: node <guide>/scripts/value-objects-in-storage/value-objects-in-storage.ts. It rewrites every contract and snapshot, renames each snapshot directory to its new storage hash, and rewrites the migrations, refs, migration.ts and contract.d.ts files that name an old hash. It prints each <old> -> <new> hash. A second run changes nothing.
  4. Sign each database: prisma db sign --db "$DATABASE_URL". A database you could not migrate first is signed at the new hash of its marker's hash with prisma db sign --contract <new hash> --no-advance-ref, then migrated.
  5. Re-emit the contract: prisma contract emit.
  6. On Postgres, find the rows that would fail the new checks with the query the guide gives, and fix them. Then plan the migration that adds the checks with prisma migration plan, and apply it with prisma db migrate --advance-ref db --db "$DATABASE_URL". On MongoDB there is nothing to plan.

Adding a check takes a lock on the table while Postgres reads every row, and a later change to the value object replaces the check and reads the rows again. The guide says so.

Extension authors:

  • read value objects from contract.storage: contractModelToMongoResultShape, contractFieldToMongoFieldShape and compileMongoQuery take the storage, and MongoValueObjects is removed;
  • ValueObjectTypesFromDomain is now ValueObjectTypesFromStorage, and FieldTypesFromDomain takes the storage namespaces as a required sixth argument;
  • each Postgres codec declares jsonType, and the check expression types moved to @prisma/orm-postgres/family-contract/check-expressions.

The script and both guides were run from start to finish on copies of prisma-8-demo and mongo-demo with real migration histories, including a database behind the last migration and a row that breaks the new check. A second migration plan afterwards writes nothing.

Testing performed

  • New journeys: value-object-checks.e2e.test.ts (10 cases) and value-object-validator.mongo.e2e.test.ts (2 cases).
  • Existing journeys: enum value statements (Postgres and SQLite), namespace statements, plans with no operations (Postgres, SQLite, MongoDB).
  • test/integration/test/sql-orm-client/ (142 files), the upgrade script's integration test, the print round-trip files.
  • pnpm fixtures:check, pnpm lint:deps, pnpm lint:ratchets, pnpm check:error-reference, pnpm check:upgrade-coverage --mode pr.
  • Typecheck, lint and test --coverage in each touched package.

Skill update

skills/prisma-8/references/contract.md says value objects are lowered to storage value objects, describes the derived Postgres checks and the discriminator value set, and says a value object change is a migration.

Follow-ups

  • The value object and variant statements (--rename Address.street:Address.line1, --convert Bug, --delete Bug) are the next pull request. It also adds --backfill for a new required value object member, so rows that lack it can be filled without a hand-written update.
  • TML-3750: the SQL ORM cannot create a variant through the variant's own model (orm.Bug.create); orm.Task.variant('bug').create works. This fails on main too.
  • Recorded in projects/migration-statements/deferred.md: the SQL TypeScript builder has no value objects; SQL PSL does not namespace composite types; a column's value set reference is not checked against storage; the SQL ORM cannot write a BigInt or Bytes member of a value object.

Alternatives considered

  • Keep value objects in the domain plane, because the tables do not change. Then the migration system can never see a value object change, even to refuse it, and the old keys stay in every row.
  • Keep them in the domain plane and record a change as a migration from a hash to itself. Snapshots are saved by storage hash, so a plan's previous contract can be several changes old, and db update, which runs no data operations, still could not apply it.
  • Copy the definition into storage and keep the domain copy. Two copies of one definition invite drift, and the domain plane can already refer to storage.
  • Feed the domain value objects into the storage hash without moving them. The hash would change, but the planner compares storage, so it still could not tell what changed.
  • Record the facts in storage without enforcing them. The planner would see every change, but Postgres and MongoDB would give up enforcing the shape and the variants' values, which the ORM never enforced either.
  • Check a flat value object with the key-set operators ?& and -. One strict jsonpath predicate covers nesting, lists, member types and nullability, and one form for every shape is simpler to derive and to read back.

Checklist

  • All commits are signed off (git commit -s) per the DCO.
  • I read CONTRIBUTING.md and the change is scoped to one logical concern.
  • Tests are updated.
  • The PR title is in TML-NNNN: <sentence-case title> form.
  • The Skill update section above is filled in.

Agent: radagast-20

Sorry, something went wrong.

Uh oh!

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

All reactions
wmadden-electric added 30 commits October 23, 2026 10:37
@wmadden-electric
TML-3537: plan for value objects in storage, and the first two dispat…
45fb5b6
…ch briefs

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: refuse only an actual value-set clash, not dotted enum names
5656914
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: list the storage entities that differ between two contracts
e4cf4d2
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: migration plan writes a migration with no operations when t…
a009fad
…he storage changed

When the storage hash changes but the planner plans nothing, migration plan
writes the package with an empty ops.json and names the storage entities
that changed (changedStorageEntities in --json). db migrate and db update
move the marker. Only a first migration with no operations is still refused.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a domain field refers to its value object by a storage coor…
d607bde
…dinate

EntityCoordinate moves to @internal/contract, so the foundation can use it.
ValueObjectFieldType is EntityCoordinate<'storage', 'valueObject'> with
kind 'valueObject'; ValueSetRef extends EntityCoordinate. The domain plane
no longer has valueObjects. Domain validation checks each value object
reference against storage.namespaces.<ns>.entries.valueObject and refuses
the old domain key. valueObjectAt and storageValueObjectsAtDefaultNamespace
replace domainValueObjectsAtDefaultNamespace.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: SQL contracts store value objects under storage entries.val…
1792de2
…ueObject

A StorageValueObject entity kind with its schema; a member typed by an enum
refers to the storage value set. A domain field type refers to the value
object by its storage coordinate. The domain namespace schema drops
valueObjects, and an old contract that has it is refused with a message
that says to re-emit. The editor JSON schema is regenerated.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: Mongo contracts store value objects under storage entries.v…
965c0cf
…alueObject

A MongoValueObject entity kind with its schema; a member typed by an enum
refers to the storage value set. A domain field type refers to the value
object by its storage coordinate. The domain namespace schema and the
contract serializer refuse the old domain valueObjects key with a message
that says to re-emit. Readers of a field's value object name use entityName.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: SQL authoring writes value objects and discriminator value …
4f7338e
…sets into storage

The SQL build writes each value object to entries.valueObject of the default
namespace before the storage hash, and fields and nested members refer to it
by its storage coordinate; an enum member refers to the storage value set.
A model node now carries its discriminator, variants and base, so the build
writes the <Base>.<field> value set and points the discriminator column at it.
An enum-typed discriminator keeps the enum's value set, and an enum named like
the discriminator's value set is refused. SQL PSL pairs variants before the
build instead of patching them in afterwards.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: Mongo authoring writes value objects into storage
669f4b9
The Mongo builder writes value objects to entries.valueObject and
buildMongoStorage hashes them. field.valueObject, Mongo PSL and the
Prisma 6 reader write the storage coordinate. A value object member typed
by an enum refers to the storage value set, and the validator refusals
count such enums. The Mongo target serializer carries every entries kind
through deserialize and serialize. The derived validators do not change.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: test-utils createContract writes value objects into storage
d362ce9
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a plan with no operations keeps its summary and adds what c…
46322ba
…hanged

The no-operations sentence is appended to the existing summary, so an
automatic baseline keeps its baseline text and a plan keeps its extension
migration directories.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: changedStorageEntities leaves out the unbound namespace id
ba44c87
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a plan with no operations names the storage keys that chang…
2de7579
…ed when no entity did

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: docs no longer describe the removed refusal of a plan with …
9f82c81
…no operations

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a value object reference by name says the contract must be …
299a8ca
…re-emitted

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: valueObjectAt reads only own namespaces and tolerates a nam…
6279851
…espace without entries

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a value object member's value set is typed as a storage val…
649758e
…ue set

ContractValueObjectField types valueSet as EntityCoordinate<'storage',
'valueSet'>, so a value object cannot refer to the domain plane by type. The
SQL and Mongo builders write members and model fields through separate
functions.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a value object member's value set must exist in storage
b8916a3
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: dispatch briefs for authoring and emit, and the column valu…
2286fe4
…e-set check as deferred

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: field types find a value object in the storage namespace it…
d196e48
…s reference names

FieldTypesFromDomain takes the storage namespaces as a last type parameter with a default, so a contract without value objects types its fields as before. ValueObjectTypesFromStorage replaces ValueObjectTypesFromDomain and is keyed by storage namespace.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: contract.d.ts describes value objects in the storage plane
0195e97
The SQL and Mongo emitters write entries.valueObject in the storage namespaces type. A value object field type is its storage coordinate. The domain valueObjects line and the top-level valueObjects block are gone. A value object member's override reads the storage value set it names. The Mongo builder types value objects in storage too. A contract without value objects emits the same text as before.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a discriminator value set holds its values sorted, so decla…
bbd50ff
…ration order does not change the storage hash

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a discriminator value set is refused only when its namespac…
983929c
…e already has a value set of that name

The refusal checks the base table's storage namespace, not every enum, and uses the colon form of the other enumType messages.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: two composite types with the same name in different PSL nam…
3f08cce
…espaces are refused

Every value object is stored in the default storage namespace and models refer to composite types by bare name, so the second one silently replaced the first.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: test-utils writes value objects into storage without a cast
207b0b6
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a plan with no operations names the changed storage keys wh…
9fe305d
…en storage is a class instance

Real families hydrate storage into a class, which isPlainRecord rejects, so every such plan said the change was outside the storage entities.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: dispatch briefs for runtimes and Postgres checks, and the c…
90611d5
…orrected reason for the clash refusal

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: the Mongo ORM and query builder find a value object through…
7f4890e
… the field's storage reference

Run time reads go through valueObjectAt; type-level reads go through the new ContractValueObjectAt. The dead fallback to the flat valueObjects block of contract.d.ts is gone.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: contract.d.ts has no blank line between meta and profileHash
7d40131
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: rename statements find value objects in storage
4b69faf
The statement resolver still refuses a statement that names a value object, but looks for it under storage entries.valueObject. A statement contract now carries its storage namespaces.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added 12 commits October 23, 2026 20:03
@wmadden-electric
TML-3537: functions that read only storage take Pick<StorageBase, 'na…
8d8fddd
…mespaces'>, and ContractWithDomain stays on functions that read the domain

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: one framework schema validates a field's type for domain fi…
ba6d0ea
…elds and value object members in both families; ContractValueObjectSchema is named after its type; SQL's value object schema leaves out unions and dictionaries by its structure, and its refusal names the value object and the member

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: regenerate the SQL contract JSON schema, which now refuses …
b7c1bf1
…union and dictionary value object members and checks a domain field's type

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: migration plan --json lists the changed storage entities as…
63d5788
… changedStorageEntities, the words its README and summary use

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: the upgrade script writes nullable false where an old Mongo…
e21fb97
…DB value object member leaves it out, and drops dict false

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: ADR 221 and ADR 309 say the framework defines valueObject a…
3f510c4
…nd reads the valueSet slot; ADR 309 describes the codec's JSON type, and its first consequence and the rejected alternative agree with the cases that have no operations

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: the print refusal tests expect the value object named in th…
22fd7fb
…e SQL refusal, and the missing jsonType error says why without guessing the codec's age

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: the manual QA report for PR 3, and the brief for its fixes
4d902bc
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: a registered Postgres codec descriptor may lack jsonType, t…
08c5d5e
…he upgrade script keeps a malformed nullable, and ADR 309 gives the full check name

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: the no-operations summary writes the entity kind in words, …
c8c8edf
…and db update says when it signs a changed contract with no operations and names what changed

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: when existing rows fail a check the apply adds, the failure…
cbf923e
… names the check, table and column, gives the query that finds the rows, and the route that keeps them

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3537: the upgrade steps upgrade the packages before the script an…
7db1126
…d apply with --advance-ref db, so the next plan writes nothing; the advice to fix rows re-runs db migrate with its flags

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric requested a review from a team as a code owner October 23, 2026 19:21
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

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 Oct 23, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

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

@prisma/orm-extension-middleware-cache

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

@prisma/orm-extension-paradedb

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

@prisma/orm-extension-pgvector

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

@prisma/orm-extension-postgis

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

@prisma/orm-extension-supabase

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

@prisma/orm-family-mongo

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

@prisma/orm-family-sql

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

@prisma/orm-framework

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

@prisma/orm-mongo

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

@prisma/orm-mysql

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

@prisma/orm-postgres

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

@prisma/orm-sqlite

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

@prisma/orm-target-mongo

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

@prisma/orm-target-mysql

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

@prisma/orm-target-postgres

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

@prisma/orm-target-sqlite

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

@prisma/orm-toolchain

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

commit: b8bc677

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions

github-actions Bot commented Oct 23, 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 272.86 KB (+1.18% 🔺)
postgres / emit 238.9 KB (+0.53% 🔺)
mongo / no-emit 225.33 KB (+0.46% 🔺)
mongo / emit 184.94 KB (+0.46% 🔺)
cf-worker / no-emit 335.12 KB (+1.12% 🔺)
cf-worker / emit 297.59 KB (+0.55% 🔺)
All reactions

Sorry, something went wrong.

Uh oh!

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

wmadden-electric added 2 commits October 23, 2026 21:30
@wmadden-electric
TML-3537: the demo migrations sort their snapshot imports
d846707
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
Merge branch 'main' of https://github.com/prisma/prisma into tml-3537…
1ad91b6
…-value-objects-storage

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

# Conflicts:
#	docs/architecture docs/ADR-INDEX.md
wmadden
wmadden approved these changes Oct 28, 2026
View reviewed changes
@wmadden
wmadden added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026

Uh oh!

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

wmadden-electric added 2 commits October 28, 2026 15:08
@wmadden-electric
Merge branch 'main' of https://github.com/prisma/prisma into tml-3537…
40fe413
…-value-objects-storage
@wmadden-electric
TML-3537: the value object journeys load only workspace packages, so …
b8bc677
…the CLI they run in-process sees one copy of Prisma ORM

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden enabled auto-merge October 28, 2026 14:16
@wmadden
wmadden added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 10495aa Oct 28, 2026
24 checks passed

Uh oh!

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

@wmadden
wmadden deleted the tml-3537-value-objects-storage branch October 28, 2026 14:50
@wmadden-electric wmadden-electric mentioned this pull request Oct 30, 2026
chore(release): bump to 8.0.0-rc.22 #30919
Merged
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-prisma__orm that referenced this pull request Oct 30, 2026
@wmadden-electric @claude
chore(release): bump to 8.0.0-rc.22 (prisma#30919)
4f70a33
`8.0.0-rc.21` → `8.0.0-rc.22`. See
[versioning](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md).

**Publishing was broken and is fixed.** From 23 October every `Publish
to npm` run on `main` failed with `ENEEDAUTH` on three packages that had
never been on npm: `@prisma/orm-mysql`, `@prisma/orm-target-mysql`
(prisma#30856) and `@prisma/orm-postgres-contrib` (prisma#30904). Trusted publishing
cannot authenticate a package that does not exist yet. They were
published once by hand and given a trusted publisher; the re-run of run
41053844815 then published all three from CI. The failed runs had also
skipped the rc.21 git tag and GitHub Release, which the upgrade-coverage
check needs to find the previous release.
[`v8.0.0-rc.21`](https://github.com/prisma/orm/releases/tag/v8.0.0-rc.21)
now exists at the rc.21 release commit `fad17c1d03`.

**Merging this PR ships the release.** The push to `main` carries the
new root version. The `Publish to npm` workflow then publishes
`8.0.0-rc.22` under the `latest` dist-tag and creates a pre-release
GitHub Release.

## What to review

- **Release notes:**
[`docs/releases/v8.0.0-rc.22.md`](https://github.com/prisma/orm/blob/release/8.0.0-rc.22/docs/releases/v8.0.0-rc.22.md),
mirrored in `CHANGELOG.md`. Seven breaking changes: the PostgreSQL
convenience date and time types (prisma#30847), value objects in storage
(prisma#30869), the MongoDB execution context (prisma#30865), the MongoDB driver
descriptor (prisma#30906), packs declaring their Postgres extension (prisma#30902),
one installed copy of Prisma ORM (prisma#30883) and merged MongoDB indexes
(prisma#30894). Six features and two fixes. The notes leave out prisma#30728
(telemetry backend), prisma#30891 (CI), prisma#30901 (tests), and prisma#30862, prisma#30895,
prisma#30897 and prisma#30898 (docs only).
- **Upgrade guides:**
`skills/prisma-8/upgrading/{app,extension}/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/instructions.md`,
assembled from the fifteen pending fragments (the fifteenth, from
prisma#30918, declares no change). The app guide has 19 changes plus the
Supabase restamp, opens with the order to do the steps in, and ships one
script (`value-objects-in-storage`). The extension guide has 16 changes.
None was dropped. The originals are archived unchanged under
`upgrade-instructions/releases/8.0.0-rc.21-to-8.0.0-rc.22/sources/`.
- **Corrections made while assembling:**
- `mongo-runtime-takes-adapter` said `createMongoExecutionStack()` no
longer takes a `driver`. prisma#30906, merged later, gave it one back, and the
driver entry tells you to pass it. The entry now says what `main` does,
and its detection no longer flags a stack built with a driver.
- The convenience types entry now says to leave a `DateTime(as: ...)`
field alone, and the step order renames the old types before rewriting
the `temporal.*` aliases. Otherwise an agent would rename the
`DateTime(as: temporal)` the alias table writes.
- References to "this release's guide" now name the rc.20 → rc.21 guide
they meant.
- **Tests:** the upgrade-instruction tests read the published guides and
script. The `value-objects-in-storage` tests no longer call live
framework code: the two tests that checked the fixtures against this
release's serializers are removed, and the one hash they computed is a
recorded constant.
- **Version bump:** every `package.json`, `pnpm-lock.yaml` (workspace
specifiers only), the skill's `library_version`, and the Supabase
contract version stamps.

## Checks run locally

- `check:upgrade-coverage --mode publish --prev fad17c1 --head HEAD`:
pass. The `--mode pr` form CI runs passes now that the tag exists.
- `check:release-notes --mode pr`: pass
- `lint:skills`: pass
- `test/upgrade-instructions`: 102 files, 1,980 tests pass

The prisma/web docs PR follows once this is published.

Agent: paddington-54

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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added repeatable client `connect()` behavior, PostgreSQL extension
declarations and additional types, plus MySQL ORM and SQL-builder read
support.
* **Breaking Changes**
* PostgreSQL date/time defaults and types, value-object storage, MongoDB
APIs and indexes, and extension-pack migrations have changed. Review the
upgrade guidance before updating.
* **Bug Fixes**
* Improved precision for PostgreSQL `now()` values and clarified Prisma
7 `@db.*` diagnostics.
* **Documentation**
  * Added Prisma 8.0.0-rc.22 release notes and upgrade instructions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@wmadden wmadden wmadden approved these changes

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.

2 participants

@wmadden-electric @wmadden
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.