Skip to content

feat!: Prisma ORM packages name each other as peers, so an application gets one copy of each - #31204

Merged
wmadden-electric merged 67 commits into
mainfrom
tml-3935-platform-packages-as-peers
Nov 25, 2026
Merged

wmadden-electric merged 67 commits into
mainfrom
tml-3935-platform-packages-as-peers

Conversation

@wmadden-electric

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

Copy link
Copy Markdown
Contributor

Blocks merge: prisma/prisma-cli#405 must be merged and released first. It adds one line to the prisma command-line tool, explained under "Before you approve".

At a glance

A PostgreSQL application installs one package of ours today, @prisma/orm-postgres. That package brings the rest as its own dependencies:

// @prisma/orm-postgres/package.json, published
"dependencies": {                          // after this change: "peerDependencies"
  "@prisma/orm-family-sql": "8.0.0-rc.26",
  "@prisma/orm-framework": "8.0.0-rc.26",
  "@prisma/orm-target-postgres": "8.0.0-rc.26",
  "@prisma/orm-toolchain": "8.0.0-rc.26"
}

After this change they are peer dependencies, and the application lists them itself:

 // the application's package.json
 "dependencies": {
+  "@prisma/orm-family-sql": "8.0.0-rc.26",
+  "@prisma/orm-framework": "8.0.0-rc.26",
   "@prisma/orm-postgres": "8.0.0-rc.26",
+  "@prisma/orm-target-postgres": "8.0.0-rc.26",
+  "@prisma/orm-toolchain": "8.0.0-rc.26"
 }

prisma orm init writes these lines. Application code does not change: it still imports only from @prisma/orm-postgres and from extensions. (Under npm the lines read ^8.0.0-rc.26; see "Decisions made while building this".)

The decision

  1. No @prisma/orm-* package installs another as its own dependency. Each names the others it uses as peer dependencies.
  2. An application lists its facade, the package for its database such as @prisma/orm-postgres, and every platform package that facade names. The platform packages are the four added above: the framework (the core), the SQL family (what all SQL databases share), the PostgreSQL target package (what is specific to PostgreSQL) and the toolchain (the prisma orm commands). Applications never import them; extensions are built on them.

What this gives a user now: when two of our packages disagree on a version, the package manager reports it, where today it silently installs a second copy. Versions stay exact until 8.0.0, so an extension built for another release candidate is still not usable; it is now refused or warned about instead of half-working.

Why now: this cannot be changed after 8.0.0. Once applications exist that list only their facade, making the platform packages peers would break every one of them under Yarn.

This is a breaking change for anyone on a release candidate. An existing application adds the lines; an extension moves its @prisma/orm-* dependencies to peers. Upgrade instructions for both are included.

Why

An application must have exactly one copy of each platform package. An extension's data types, codecs and operations are made with its copy and used by the client's copy, and the platform packages recognise a data-type value by which copy made it: the value carries a private field only its own copy can read. A data-type value from another copy is refused with an error that does not name the cause, and TypeScript reports errors where the two copies' types meet.

The package manager decides how many copies there are. When package A lists package B as an ordinary dependency, the package manager gives A its own copy of B whenever the version A asks for differs from one already installed. When A lists B as a peer, A never gets its own copy: it uses the application's.

So ordinary dependencies give two copies as soon as versions differ. An application that installs an extension built for another release gets the extension's own framework beside its own, silently.

With peers everywhere, only the application's own list brings a copy. And the application has to list them, because Yarn installs no peer the application does not list: without the lines, a Yarn application cannot load its facade.

How this was chosen. A first trial compared six ways of arranging the dependencies, with stand-in packages on a local registry, under npm, pnpm, Yarn (both install modes) and Bun (both install modes). This is the simplest that gave one copy under all of them. The rejected arrangements are under "Alternatives considered".

What changes

  • Package manifests under packages/9-public/@prisma/: every @prisma/orm-* entry moves from dependencies to peerDependencies, and is repeated under devDependencies so the workspace installs it.
  • Two checks that refuse an ordinary dependency between our packages. The build of each published package already compares its manifest with the packages its code imports (validateShellManifest in packages/0-config/tsdown/shell-build.ts); it now requires each of ours to be a peer. The check that runs before publishing (scripts/check-publish-deps.mjs) gains the same rule. The second is needed for @prisma/orm-better-auth, which is not built through the first.
  • prisma orm init. After installing the facade, it reads that package's peers from the installed manifest, follows them until no new @prisma/orm-* name appears, and installs each. It holds no list of package names: the manifests are the list.
  • init also installs the other required peers, such as temporal-polyfill and @types/pg. The facade imports them, and on main an application made by init under Yarn cannot emit its contract because they are missing. Found in manual testing.
  • Tests. Four packaging test files install the packages as packed for publishing. One requires that the application, @prisma/orm-postgres and the pgvector extension all resolve the same single copy of each platform package. One packs the SQL family a version ahead and requires the install to report it.
  • Examples, docs, the prisma-8 skill, the glossary, and upgrade instructions under upgrade-instructions/pending/platform-packages-as-peers/.
  • Terminology. The glossary now separates the target (the component that supports one database), the target package (@prisma/orm-target-postgres) and the facade (@prisma/orm-postgres, which glues the framework, family, target, adapter and driver together). Earlier work called the facade a "target package"; every file this pull request touches now uses the defined terms, and the two records that introduced the wrong one are renamed: "Generated files import from the module the facade names" (ADR 324) and "init gets everything about a database from its facade" (ADR 325). Text users read says "the package for your database", never "facade". About 300 uses elsewhere on main are left for a pull request of their own, recorded in the project's deferred.md.
  • A decision record, ADR 329. It replaces the rule in the record on the published packages (ADR 242) that an application installs one package of ours and names nothing else. That rule existed because a user who listed several packages had to keep the versions right by hand and got two silent copies when wrong; with peers, the package manager checks the versions. The earlier records this changes (ADR 242 on the published packages, ADR 325 on init, ADR 328 on library integrations) are updated in place to describe how things work now, with no notes saying they were superseded, and the index's rule on changing a decision now says to do that.

Decisions made while building this

The agreed design for this work (projects/ga-compatibility/designs/6-maturity-versions-and-dependencies.md, in draft pull request #31193) left these open or got them wrong:

  • The platform packages name each other as peers too. The design left this open. In a second trial, ordinary dependencies between them gave two copies under Bun and under Yarn.
  • One extension is tied to a facade: Supabase names @prisma/orm-postgres as a peer. The design says an extension is never tied to one. Supabase imports it today, and whether Supabase should be an extension or a facade of its own is not decided. The decision record names the exception.
  • The ParadeDB extension no longer names the PostgreSQL target package. It imports nothing from it.
  • A MariaDB application lists MySQL's packages too, because @prisma/orm-mariadb is built on @prisma/orm-mysql.
  • The application's lines are written as its package manager writes them. pnpm, Yarn and Bun wrote exact versions; npm wrote ^8.0.0-rc.26 on every line. init installs through an interface from another repository that cannot ask for an exact line. This is safe: all lines in a project are written the same way, so an update moves them together, and if a user moves only one, the peers report the mismatch.

Before you approve

Blocks merge

Known limits

  • A monorepo with two applications on different Prisma versions can still get two copies, silently, under npm workspaces and Bun's hoisted mode. Both put an extension the two applications share in one place for the whole repository. pnpm, Yarn and Bun's isolated mode do not. No arrangement of dependencies changes where a package manager puts a package; the docs tell such a monorepo to keep its applications on one version or use another package manager.
  • init does not work under Yarn's default install mode, Plug'n'Play, and did not before. It looks for installed packages in node_modules folders. Its error now names the Yarn setting that makes it work. The fix is tracked in TML-3940.

Follow-ups outside this pull request

  • Prisma Composer, Prisma's deployment tool, carries its own toolchain like prisma and needs the same line; its examples and guide need the new packages. TML-3939, when it moves to the release that carries this.
  • The install instructions on the Prisma 8 docs site change with the release that carries this.
  • A facade now names its database driver in two places: its manifest, which init reads, and the peerPackages field of what it exports for init. Removing the field changes an interface that facades outside this repository implement, so it is left and recorded in the project's deferred.md.

How it was verified

Automated: unit tests of both checks, the tests of init, and a test that runs init's collection against the real manifests of the five facades (PostgreSQL, SQLite, MySQL, MariaDB, MongoDB). The four packaging files are in the integration suite, which pull-request CI does not run; all four were run on this branch and pass.

By hand, with the packages as packed for publishing, served from a registry on 127.0.0.1, under six setups: npm 12.2.3, pnpm 10.27.0, Yarn 4.19.0 in both install modes, Bun 1.3.13 in both install modes.

Case Result
An application that lists the facade, the platform packages and pgvector One copy of each platform package in all six setups, and every entry point loads
The same application without the platform-package lines Yarn installs none of them and the application cannot load; the others fill them in silently
One platform package at another version npm refuses the install; pnpm, Yarn and Bun install and warn
prisma orm init for PostgreSQL in an empty project, then emit the contract, create the tables and run a query Works under npm, pnpm, Bun, and Yarn with node_modules, with nothing added by hand; a second run changes nothing
prisma orm init for MongoDB Works under pnpm and Yarn with node_modules; no query, as no MongoDB server was available
MongoDB, SQLite and MariaDB applications, set up by hand One copy of each, under pnpm and Yarn Plug'n'Play, the two that differ most
The upgrade instructions, for an application and for an extension Followed by hand under pnpm and Yarn Plug'n'Play; sufficient

Reviews: a system-design review and a code review by reviewers who did not build it, with every finding fixed, and the code reviewer's confirmation of the last commits. The review bot's comments are answered in their threads; one was declined, with the reason there.

Not run locally: the whole test suites, which CI runs.

Alternatives considered

  • Keep ordinary dependencies. Two copies whenever an extension and the application are on different releases, in every setup.
  • The facade keeps the platform packages as ordinary dependencies; extensions name them as peers. Two copies under npm, with no warning. Broken under Yarn, because the application does not list what the extension needs.
  • Peers everywhere, but the application lists only the facade. Yarn installs no peer that is not listed, so the facade cannot load.
  • An extension names only the facade as its peer. One copy everywhere, but a PostgreSQL extension would then work only with @prisma/orm-postgres, not with any other facade built on the PostgreSQL target package.
  • An extension names only the target package as its peer, and reaches the framework and family through it. One copy in most cases, but two copies with a warning when the application's lines for the facade and the target package disagreed, and broken under Yarn when the application did not list the target package.
  • Detect a second copy when the application starts, and stop. A release candidate did this, and the next one removed it: Prisma Composer deliberately loads a second copy of the ORM beside the application, and the check stopped it. A check that only reports two copies that are actually used together is still wanted, and is separate work.

Fixes TML-3935

Agent: keithrichards-58

🤖 Generated with Claude Code

wmadden-electric and others added 30 commits November 24, 2026 23:09
…sions and dependencies

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The shell build now expects each sibling package a shell reaches, through
its bundled packages or a facade re-export, under peerDependencies, and
refuses one under dependencies or optionalDependencies. The peerShells
field of the shell map is removed. ParadeDB's internal package declares
its optional peer on the Postgres target so the published package keeps it.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Every example, app and test application that lists one of the published
packages now also lists each sibling that package names as a peer,
following peers of peers. test/prisma-bin lists the framework beside its
toolchain.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
pnpm resolves a peer through the registry, not through the tarball
overrides, so a scratch application that left a platform package out got
the published copy of it: the facade-only install passed on registry
copies, and the pgvector test failed on a second copy of the framework.
installShells now fails when any @prisma/orm-* package came from the
registry, and each packaging test lists the platform packages the way an
application now does.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…es name each other as peers

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…mes as peers

After installing the database package, init reads its installed manifest,
collects every @prisma/orm-* peer and the peers those name, and installs
each at the range the manifests declare, with the database package pinned
to the version it resolved. It reads manifests a package manager that
installs no peers puts on disk only after init's own install. A package the
project already lists at another range is left alone and reported;
--skip-install prints the same list.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The project the init journey installs now lists every package its facade
names as a peer, read from the workspace manifests, as init does. This
replaces listing only the target package for migration.ts.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…fails to install

The pgvector packaging test now checks that the application, the
PostgreSQL package and the extension resolve the same folder for each of
the four platform packages, and that each is installed once. A new case
packs the SQL family one version ahead and requires the install to fail
under strict peers, naming the mismatch.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ed platform install says how to undo

The printed Prisma 6 side-by-side install command now names the Prisma ORM
packages the database package names as peers, read from the installed
manifests and, for a package not installed, from the registry. It names the
database package alone when neither can be read.

When installing a platform package fails after init installed the database
package, the failure carries the existing instruction to remove what init
installed.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…facade

The facade READMEs give the full install command, say once why the
application lists the platform packages, and warn about two versions in
one monorepo. The platform package READMEs say an application lists them
beside its facade instead of receiving them as exact-pinned dependencies.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ons name them as peers

The quickstart, the build, contract and upgrade references, the target
package guide, the naming conventions, the error reference and the rule on
example timeouts now describe the application listing the platform
packages beside its database package. The extension exact-pin rule makes
every Prisma package a peer dependency and a development dependency, and
its one-line check enforces that. Role detection no longer mistakes an
application that lists the framework for an extension.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…isma packages peers

Pending upgrade instructions for both audiences: an application adds every
package its database package and extensions name as peers, at the database
package's version; an extension moves every Prisma package from
dependencies to peerDependencies and devDependencies.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…e glossary's word for the target package

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ional sibling peer, and drop ParadeDB's peer on the target

The shell build now refuses a manifest whose sibling peer is missing from
devDependencies or is marked optional in peerDependenciesMeta. ParadeDB
names only the platform packages it uses, so its peer on the PostgreSQL
target, kept before through an optional internal peer, is removed.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… ordinary dependency

check-publish-deps now fails when a packed manifest holds another package
this repository publishes under dependencies or optionalDependencies. It
covers @prisma/orm-better-auth, which the shell build does not check.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…eer package, and reads the registry in parallel

init's list of the @prisma/orm-* packages a target package names as peers,
directly or through another, now has one name in the code: its Prisma ORM
peer packages (init-orm-peer-packages.ts).

- A listed package is a mismatch only when its installed copy is at
  another version, or, when none is installed, its line cannot stand for
  the version: a catalog:, workspace: or other protocol line, or a caret on
  the version, is not. A second run after a package manager wrote carets
  warns about nothing.
- The --json document says, for each package, whether init installed it,
  found it already listed, left it at another version, or left it to
  install; deps no longer names a package init left alone.
- The printed Prisma 6 setup reads the registry through an injected lookup,
  one level of peers at once under one time limit, and warns when it could
  not read a package's peers.
- A test runs the collection against the manifests of the five target
  packages this repository publishes.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…eers

pkg-pr-new rewrites sibling dependencies to preview addresses but not peer
dependencies; with --peerDeps it sets them to a version, not an address.
Say where previews are described that a preview of one package is
installed together with the previews of the packages it names as peers.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…the stale statements of the old arrangement

- Use the glossary's "target package" where this branch wrote "database
  package", "platform package" where it wrote "SPI package", and add a
  glossary entry for platform packages.
- Reword the facade package descriptions, the publish-surface README and
  shells.ts comments, the facade READMEs' reason for forwarding namespaces,
  the PostgreSQL README's decomposing section, and the target-package-config
  README, which still described an application installing one package.
- The facade README install commands write exact versions.
- Say what init now installs, reports and reads from the registry in the
  CLI README and the CLI subsystem doc.
- upgrade-app.md says a version mismatch is reported at install;
  build-a-target-package.md says exactly what init lists.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ackage manager

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ime limit and cancelling

A package.json line that is a plain version or range now decides whether a
listed Prisma ORM peer package is at the version asked for, whatever copy
is installed; the installed copy decides only for a protocol line such as
workspace: or catalog:. The registry time limit is a timer the tests can
advance, and new tests show it is shared by every read and that cancelling
the command is passed through. The test against the five target packages
now reads their real manifests with init's own reader.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ADME matches init

- The facade READMEs no longer promise exact lines: init writes the list in
  the form the project's package manager writes a version, and the manual
  install commands give every @prisma/orm-* package the same <version>,
  with the driver on its own line. The Mongo source README does the same.
- The CLI README's peer-packages paragraph sits above the failure list,
  says what the install trial showed each package manager writes, and
  describes the line-first check; its --json example shows
  ormPeerPackages.
- The naming conventions say an extension names exactly the platform
  packages its code uses; ParadeDB and the cache middleware do not name
  the PostgreSQL target.
- The pending app upgrade instructions ask for the same version on every
  line, written the way the target package's line is.
- check-publish-deps numbers its checks in order.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
A caret line init wrote for one release candidate still admits the next
one after an update, so judging it by its text warned falsely on a second
run. An exact version line is still judged by its text; a range, a
dist-tag or a protocol line is judged by the installed copy, and counts as
listed when none is installed.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The list is about to hold the target package's required peer
dependencies that are not Prisma ORM packages too, so ormPeerPackages
becomes requiredPeers (module init-required-peers.ts, the --json field
packagesInstalled.requiredPeers). No behaviour changes.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ops under --skip-install when one is missing

Under a package manager that installs no peer dependencies, such as Yarn,
an application made by init could not load: the target package names
temporal-polyfill (and, for PostgreSQL, pg and @types/pg) as required
peers, and init added only the driver. This gap is older than this branch.

- The list init collects now holds, besides the @prisma/orm-* packages
  the target package names as peers, every other required peer those
  manifests name (not marked optional in peerDependenciesMeta), whose own
  peers are not followed. The engine, which init installs as a
  development dependency, is left out; a driver is installed once. A peer
  the project already lists is left. Type-only packages such as
  @types/pg are added as ordinary dependencies, since the manifest does
  not say otherwise.
- Init works the list out before loading <package>/init. Under
  --skip-install, when a required peer is not installed, it stops with
  CLI.INIT_REQUIRED_PEERS_NOT_INSTALLED, naming the add command, instead
  of the module-resolution error. When the init entrypoint cannot load
  and a required peer is missing, the fix says so.
- The printed Prisma 6 setup reads optional flags from the published
  manifests too.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…manager writes

- The CLI README and subsystem doc describe the required peers init now
  adds and the --skip-install refusal, and say that init does not support
  Yarn Plug'n'Play (set nodeLinker: node-modules); the quickstart says so
  too. That limit is older than this branch: installedManifest looks only
  in node_modules folders on main as well.
- The lines are written the way the package manager writes a version it
  is given; in testing, pnpm, Yarn and Bun wrote it exactly and the
  Node-bundled manager added a caret.
- The app upgrade instructions add the other required peers, and their
  listing command prints them, exits with an error when it cannot find a
  package it was given, and says to run it with yarn node under
  Plug'n'Play.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…d specs, and say what to do under Yarn Plug'n'Play

- A required peer counts as installed when it can be found from the
  project or from the target package's own real folder, where pnpm puts
  the peers it installs itself, so init --skip-install goes on under pnpm
  and prints the full list. When it does stop, the error says the
  packages cannot be found.
- Every printed install command and the --skip-install list quote a spec
  that holds a character a shell would read, such as a caret or a range
  with a space, in double quotes; a plain name or version stays as it is.
- In a Yarn project, CLI.INIT_TARGET_PACKAGE_NOT_INSTALLED's fix says that
  init does not support Plug'n'Play and that nodeLinker: node-modules
  makes it work.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…e engine left out of the upgrade listing

- The CLI README lists CLI.INIT_REQUIRED_PEERS_NOT_INSTALLED among the
  exit 2 codes, says where a required peer is looked for and that printed
  specs are quoted, and its --json example shows third-party peers.
- The requiredPeers schema comment, the Prisma 6 warning and two doc
  comments say required peers, not Prisma ORM peer packages.
- The error-reference entry is in alphabetical order and says the
  packages cannot be found.
- The upgrade listing command leaves out @prisma/cli-engine, as init does.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
….json already lists

Under --skip-install, a missing required peer that package.json already
lists, for example on a catalog: or workspace: line, is now put in place
by running the package manager's install command, which leaves the line
alone; the add command names only the missing peers the project does
not list.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…the facade is not the target package

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Comment thread docs/glossary.md Resolved
wmadden-electric and others added 7 commits November 25, 2026 10:48
…n place, not annotated; target, target package and facade as defined

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ines it

Every use of "target package" in this branch's files that meant the
facade (@prisma/orm-postgres and its siblings) now says facade, in prose,
comments, test titles, error text and the pending upgrade instructions.
Uses that mean @prisma/orm-target-* stay. Identifiers this branch added
for the facade are renamed: besideTarget to besideFacade, the
targetPackage parameter to facade, ownsTarget to ownsFacadeLine,
pinTarget to pinFacade, targetSpecifier to facadeSpecifier, and the
RequiredPeers field target to facade. Names, files, error codes and
subpaths that exist on main are left for a separate change.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ot "facade"

In text users read (CLI help, the picker, error messages, the published
READMEs, the prisma-8 skill, the pending upgrade instructions and the
error reference), the lines the previous commit changed now say "the
database package" or "the package for your database" in place of
"facade". Code comments, internal docs and architecture docs keep
"facade".

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…Es and the prisma-8 skill, not "facade"

The published packages' READMEs and the prisma-8 skill's references say
"this package", "the database package" or "the package for your
database" in place of "facade", in prose only: code spans, folder
names such as 9-facade, change ids and front matter keep their text. The
skill's assembled upgrade guides for past releases are left as they are.

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…laims match the trial; the index says to update an earlier record in place

The records once called the facade a target package. They are renamed, and
every link to them follows. Two CLI messages and the skill's entry no longer
use the term for the package an application installs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…s own pull request

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…rs install

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 ready for review November 25, 2026 00:08
…atform-packages-as-peers

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

# Conflicts:
#	docs/architecture docs/adrs/ADR 328 - A library integration uses only published entrypoints and its models live in the application contract.md
#	docs/reference/Package Naming Conventions.md
#	test/integration/test/packaging/orm-better-auth-tarball.test.ts
@wmadden-electric
wmadden-electric marked this pull request as draft November 25, 2026 11:10
wmadden-electric and others added 6 commits November 25, 2026 22:22
…atform-packages-as-peers

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

# Conflicts:
#	package.json
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… that made them, not because of a shared registry

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…opy that made them

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…that made them, not because of registries

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ings from test comments

Co-Authored-By: Claude Opus <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 25, 2026 12:04
@wmadden-electric
wmadden-electric marked this pull request as draft November 25, 2026 12:09
…them

Query expressions are not told apart by copy in any path that changes output, and pgvector's text projection goes through the codec descriptor found by codec id.

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 ready for review November 25, 2026 12:10
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 added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 0b1b239 Nov 25, 2026
25 checks passed
@wmadden-electric
wmadden-electric deleted the tml-3935-platform-packages-as-peers branch November 25, 2026 12:49
Thegreatsura pushed a commit to Thegreatsura/prisma that referenced this pull request Nov 27, 2026
…a.0), and release 8.0 is published as 8.0.1 (prisma#31212)

From release 8.0, the version of each Prisma 8 package says how finished
it is. This is what `prisma orm init` will write into an application's
`package.json` on release 8.3. First for PostgreSQL, which will be
Generally Available (GA):

```jsonc
"@prisma/orm-postgres":        "^8.3.0",
"@prisma/orm-framework":       "^8.3.0",
"@prisma/orm-family-sql":      "^8.3.0",
"@prisma/orm-target-postgres": "^8.3.0",
"@prisma/orm-toolchain":       "^8.3.0"
```

Then for MySQL, which will be at Early Access:

```jsonc
"@prisma/orm-mysql":        "~8.3.0-ea.0",
"@prisma/orm-target-mysql": "~8.3.0-ea.0",
"@prisma/orm-framework":    "~8.3.0",
"@prisma/orm-family-sql":   "~8.3.0",
"@prisma/orm-toolchain":    "~8.3.0"
```

The suffix `-ea.0` tells the user that the MySQL packages are at Early
Access and may change in any release. A plain version tells them a
package is GA and stays compatible until the next major version.

This pull request makes the release scripts give every package its
version, its ranges on our other packages and its npm dist-tag from its
maturity level, and makes `init` write the lines above. It also
publishes release 8.0 as `8.0.1`, for a reason explained below. Nothing
changes for users until release 8.0 is cut: until then every package is
still published at the same `8.0.0-rc.N` and names the others at that
exact version.

## The packages in these examples

The first line of each example is the **facade**, the one package an
application imports for its database. The next four are the **platform
packages** the facade is built on: the framework, the family of
databases (SQL), the database's own target package, and the toolchain
the command-line commands come from. `init` also adds `prisma`, the
command-line tool, which is published from another repository with its
own copy of the toolchain. An **extension**, such as pgvector, is a
package that adds to a database's features and is built on the same
platform packages.

Since prisma#31204, the application lists the platform packages
itself, and every one of our packages names the others as peer
dependencies. That way the package manager installs one copy of each,
and warns when the copies do not fit together.

## How the ranges fit together

The packages of one release are tested together, so the facade accepts
only its own minor of each platform package, as a peer:
`@prisma/[email protected]` asks for `@prisma/orm-framework@~8.3.0`.

The PostgreSQL application writes a caret on every line, which accepts
every later 8.x release. That does not contradict the facade's tilde. An
update moves every line to 8.4 together, and the facade at 8.4 then asks
for the platform packages at 8.4. If one line moved without the others,
the facade's tilde would make the package manager warn.

The MySQL application writes a tilde on every line, even on the GA
platform packages. A caret on `8.3.0-ea.0` never selects `8.4.0-ea.0`,
because a range only selects a pre-release of the version it names. So
the facade stays in 8.3 on an update. If the platform lines had carets,
they would move to 8.4 and leave the facade behind, which does not
accept them.

The cost falls on Early Access users: to move to the next minor, they
edit every line by hand to `~8.4.0-ea.0` and `~8.4.0`, then install.
`docs/oss/versioning.md` shows the edit. pnpm's and Yarn's update
commands do not do it correctly.

## The decision

[ADR
330](https://github.com/prisma/orm/blob/68566eec8b/docs/architecture%20docs/adrs/ADR%20330%20-%20A%20maturity%20level%20is%20written%20in%20a%20package's%20version%20and%20an%20API's%20name.md)
records it.

**Four maturity levels**, each defined by the least the maintainers do
for a package at that level:

| Level | Version | What we do, at least |
| --- | --- | --- |
| Generally Available | `8.3.0` | Its tests block the release when they
fail. A later release in the same major does not break its users. |
| Release Candidate | `8.3.0-rc.0` | As for GA, but one more breaking
change is still allowed. |
| Preview | `8.3.0-preview.0` | Its tests block the release, for what it
supports. Its docs list what it does not support yet. It may change in
any release. |
| Early Access | `8.3.0-ea.0` | Released so people can try it, even with
a failing test. It may change in any release. |

The Release Candidate level is new. It is not the same thing as today's
release candidates, `8.0.0-rc.1` to `8.0.0-rc.N`, which were numbers
that every package shared before levels existed, whatever its state.

**The version carries the level.** All our packages share the release
number, which is the major and the minor, such as `8.3`: release 8.3
publishes every package at `8.3`, changed or not. The rest of the
version belongs to each package. A GA package has its own patch number,
so a fix to it is `8.3.1` and no other package moves. A package below GA
keeps its patch number and counts in its suffix, so a fix to it is
`8.3.0-ea.1`, which a user's `~8.3.0-ea.0` still accepts. A level can go
up at any release, and within a minor only up, because a version can
only move forward.

**Each package declares its level in one place**,
`packages/0-shared/publish-surface/src/levels.ts`. At release 8.0:

- GA: PostgreSQL and its extensions, the Better Auth integration and the
cache middleware.
- Early Access: MongoDB, MySQL, MariaDB, SQLite and the Supabase
extension.
- No package is at Preview or Release Candidate yet.

**ParadeDB is the one exception.** It still lives in this repository,
but another team will maintain it, so it has no level and its own
version, starting at `0.18.0`. It was published as `0.16.0` and `0.17.0`
before, and a user's range on `0.16` or `0.17` must not pick up the new
releases.

**A GA package may not depend on one of ours below GA**, because its
users would then get breaking changes through that dependency. The build
fails if one does.

## Release 8.0 is published as 8.0.1

If release 8.0 started at patch 0, every version below GA would sort
below the old release candidates: `8.0.0-ea.0`, `8.0.0-preview.0` and
`8.0.0-rc.0` all come before `8.0.0-rc.26`. A user's `~8.0.0-ea.0` would
then accept the old release candidates. In a trial on a local registry,
Bun always installed an old one, and Yarn, npm and pnpm did in some
cases.

So release 8.0 starts every package at patch 1: `8.0.1`, `8.0.1-rc.0`,
`8.0.1-preview.0` or `8.0.1-ea.0`. GA packages start at `8.0.1` too,
although they would not collide, so that one rule covers the whole
release. The repository's version, the git tag and the GitHub release
are `8.0.1`, so the number announced is the number installed. No package
is ever `8.0.0`.

This applies only to release 8.0, the one release that follows release
candidates every package shared. From 8.1 on, every minor starts at
`X.Y.0`. The rule is in one function, `rootVersionOfRelease`, in
`release-plan.ts`.

Applications on a release candidate list our packages at an exact
`8.0.0-rc.N`, so nothing moves them to `8.0.1` by itself. Cutting
release 8.0, with its upgrade instructions and the deprecation of the
old release candidates, is the next pull request in this project.

## What the scripts compute

One function, `planRelease` in
`packages/0-shared/publish-surface/src/release-plan.ts`, gives every
package its version, its range on each of our packages it names, and its
dist-tag. `scripts/set-version.ts` writes them into the manifests, and
`scripts/check-publish-deps.mjs` fails the build when a manifest's range
differs from the plan.

- **Ranges.** A facade and the platform packages accept only their own
minor of each other (`~8.3.0`). An extension accepts any later release
of a GA package (`^8.3.0`), so an extension built for 8.1 keeps working
on 8.4. Nothing accepts more than one minor of a package below GA
(`~8.3.0-ea.0`).
- **Dist-tags.** A GA release goes under `latest`. A release below GA
also goes under `latest` while the package has never been GA, so a plain
install works. Otherwise it goes under a tag named after its level, such
as `preview`.

## Changes to `prisma orm init`

- It writes the lines at the top: a caret for a GA facade, and a tilde
for one below GA. It leaves the `prisma` line as the package manager
writes it.
- Under `--skip-install`, `init` refuses when an installed platform
package is outside the range the facade requires. Its advice used to
name a fix that did not work in some cases, for example "run install"
when an override in `package.json` forced another version. It now gives
a fix for each case: the package is not listed, listed but not
installed, listed at another version or range, or listed through a
reference such as `catalog:` or `workspace:`. Every advice ends by
saying that an override, a resolution or the lockfile may be what pins
the other version.
- Its `--json` output is unchanged. This project changes no JSON format.

## Docs

- **[Versions and
support](https://github.com/prisma/orm/blob/tml-3936-levels-versions-ranges/docs/oss/versioning.md)**
(`docs/oss/versioning.md`) is rewritten as a page for users and
extension authors: which versions are supported, the four levels by what
a user can rely on, which packages are at which level, what stays
compatible within a major and the four things that may still change, how
to upgrade a GA application and one on a database below GA, the npm
tags, and the ranges an extension lists.
-
**[Releasing](https://github.com/prisma/orm/blob/tml-3936-levels-versions-ranges/docs/oss/releasing.md)**
(`docs/oss/releasing.md`) is new. It holds what the old page had for
maintainers: who can publish, the root version, the release plan, the
publish workflow and its checks, and the release procedures.
- **ADR 330** records the decision. **ADR 329**, the record on why an
application has one copy of each platform package (merged in
prisma#31204), is rewritten to open with the failing install and the
working one side by side. It also corrects when the two-copy error
appears: when Prisma reads a value written in the contract, such as a
column default, not on every query.
- The glossary defines the levels, the release number and the root
version. A facade is now defined as the package an application's code
imports Prisma from.
- Every maturity word in the repository's docs and code comments, such
as "experimental" or "proof of concept", becomes one of the four levels.
No package, export or API name changes. Each published package's README
states its level, and a check keeps the READMEs in step with
`levels.ts`.
- The ADR also records rules for later work:
- An API in a GA package that is not finished carries its level at the
start of its name: `ea_search`, `preview_search` or `rc_search`, or
`Preview_Search` for a type and `@preview_search` in PSL. A command-line
flag, an environment variable and an error code carry no level.
- When an API moves up a level, the new name is added and the old one
stays, deprecated, until the next major version, so code that calls it
does not break as it becomes more reliable.
- A GA package stays GA until the next major version; at a new major it
may start below GA. The release scripts enforce this.
  - There are no feature flags.
- ADR 329 records that the `prisma` tool keeps its own version numbers.
When it runs an ORM command it compares the toolchain it carries with
the application's ORM packages, and stops when they are on different
minors. That check is work for the tool and is not in this pull request.
- The `prisma-8` skill's upgrade references and the extension docs tell
an extension author how to number their package and which range to list.
- Five statements that were already untrue are corrected: a capability
stability scheme that was never built, a note on ADR 017, "early-access
install" in the versioning doc, a pin rule that named an unpublished
package, and "prototype" in the decision record index and `AGENTS.md`.

## How it was checked

- `scripts/fixtures/release-plan/` holds the plan the scripts print for
the next release candidate, for `8.0.1` and for `8.1.0`: each package's
level, version, tag and ranges. `scripts/release-plan-workspace.test.ts`
fails when the scripts' output differs.
- Unit tests of `planRelease`, the version and tag scripts, the checks
of upgrade instructions and release notes, and the lines `init` writes.
- By hand, on the final code: the packages were packed as releases
`8.0.1` and `8.1.0` and served from a local registry, then tried under
npm, pnpm, Yarn and Bun.
- `init` for PostgreSQL wrote `^8.0.1` on every line, and for SQLite
`~8.0.1-ea.0` on the facade and target and `~8.0.1` on the rest.
  - Each project installed one copy of each platform package and loaded.
- An ordinary update moved the PostgreSQL app to 8.1 and left the SQLite
app on 8.0. The hand edit described above moved it.
- pgvector at `8.0.1` installed beside the `8.1.0` packages, and
ParadeDB at `0.18.0` installed on both.
- With an override forcing a platform package to another version,
following `init --skip-install`'s advice as written led to a passing
`init` under every package manager.
- A dry run of the publish workflow passed.
- Two independent reviewers, one for the design and one for the code,
reviewed the whole change and then every later commit. `pnpm build`, the
typechecks and the public API check pass locally. CI runs the full test
suites.

## Alternatives considered

- **One version for every package.** No database could be GA before
every database was, a user could not tell a finished package from an
unfinished one, and a fix to one package would need a release of all of
them.
- **Each package numbered on its own, with no shared release number.** A
user could not tell from two versions whether two packages belong
together.
- **Exact versions between our packages, as on the release candidates.**
A fix to one package would again need a release of every package that
names it.
- **A tilde on every line of a GA application too.** It would work, but
a GA user would have to edit their lines at every minor to get
compatible releases, for no safety the facade's own tilde does not
already give.
- **A caret from the facade on the platform packages.** The packages of
one release are tested only with each other, so a facade would accept
platform packages it was never tested with.
- **A separate word such as `unstable_`, or an import path such as
`/preview`, for an API that may change.** Either is a second way to say
a level, beside the version and the name.
- **Feature flags for unfinished functionality.** A flag lives in a
config file; a version suffix or a name prefix is visible in the user's
own code.
- **Release 8.0 at `8.0.0-ea.0`, with the old release candidates marked
deprecated.** Deprecation stops Yarn choosing an old release candidate,
but not pnpm or Bun.
- **Patch 1 at release 8.0 only for packages below Release Candidate,**
with GA packages at `8.0.0` and Release Candidate packages carrying on
the old `8.0.0-rc.N` counter. It keeps the number `8.0.0`, but needs a
rule for each of the three groups, the last release candidate's counter
as an input, and a special case for a package that moves up within the
release.

Agent: keithrichards-58

🤖 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**
* Prisma packages now follow release plans with package-specific
versions, dependency ranges, and release tags.
* `prisma orm init` checks installed peer packages against required
versions or ranges and reports mismatches.

* **Documentation**
* Updated Prisma 8 release and support information, database and
extension maturity levels, package versioning, and upgrade guidance.
* Clarified extension and adapter compatibility requirements, including
dependency ranges and release alignment.
* Added guidance on maturity labels and how package versions reflect
release status.
<!-- 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 Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants