Skip to content

Latest commit

 

History

History
210 lines (139 loc) · 18.1 KB

versioning.md

File metadata and controls

210 lines (139 loc) · 18.1 KB

Versions and support

This page is for people who work on Prisma ORM's repository. It says which versions are supported, what a version number tells you, what will not break when you upgrade, and how an application and an extension list Prisma's packages. Maintainers will find the release procedures in Releasing.

Users read the Prisma versioning and support policy on prisma.io. This page summarises it and adds what the repository's own work relies on, such as the v7 branch and the decision records. Where the two disagree, the published policy is right, and this page is corrected to match.

Supported versions

Version What it receives For how long
Prisma 8 New features and all fixes, in the newest release only While it is the newest major version
Prisma 7 Fixes for bugs and security issues, and no new features from the maintainers Until 18 months after release 8.0 is published
  • Prisma 8 is where development happens. It has not reached release 8.0 yet. Until it does, read Until release 8.0 first.
  • Prisma 7 is in maintenance. Its source is on the v7 branch, and pull requests for it target that branch. The maintainers build no new features for it. A feature contributed by the community can still be accepted if it fits Prisma 7's design, and so can work on the tooling that builds, tests and releases it. A maintainer decides. ADR 295 has the details.

From Prisma 8 on, these rules apply to every major version:

  • Fixes go into the newest release. To get a fix, upgrade to it. For what is Generally Available, an upgrade within a major needs no changes, apart from the four exceptions listed under What stays compatible.
  • When a new major is published, the previous one receives critical fixes and security fixes for 12 more months. Prisma 7 is the one exception, with 18 months.
  • We aim for one new major a year. That is an aim, not a promise.

SECURITY.md says how to report a vulnerability and which versions receive security fixes. The supported versions of Node.js, TypeScript and each database are on their own page. Release notes are published as GitHub Releases and kept in docs/releases/.

Until release 8.0

Prisma 8 has not had its first stable release. Today every package is published as 8.0.0-rc.1, 8.0.0-rc.2 and so on, called release candidates, and all packages share that one version.

  • Any release candidate may contain breaking changes. Nothing on the rest of this page applies yet.
  • Only the newest one is maintained. A fix ships in the next one.
  • Each one comes with an upgrade guide, linked from its release notes. The prisma-8 agent skill, which ships inside the Prisma packages, can apply the guide for you.
  • List every Prisma package at the same exact version in your package.json, such as "8.0.0-rc.25", with nothing in front of the number.

The name says less than it seems to. Every package gets the same 8.0.0-rc.N, whatever state it is in, so a package published as 8.0.0-rc.25 may be far from finished. Only from release 8.0 is "Release Candidate" a level with a defined meaning, described below.

If your project cannot keep up with breaking changes, stay on Prisma 7 until release 8.0.

Version numbers

A version has three parts: major, minor and patch. In 8.3.1 they are 8, 3 and 1.

  • The major and minor are the release. "Release 8.3" means every package at 8.3. Two Prisma packages belong together when their first two numbers match.
  • The patch belongs to each package. A package that is Generally Available has a plain version, such as 8.3.0. A fix published to that package alone would be 8.3.1.
  • A package that is not finished has its level and a counter after the version: 8.3.0-ea.0. A fix published to it alone would be 8.3.0-ea.1.
  • Today no fix is published to one package alone. A fix ships in the next release, as Supported versions says, so within a release you will normally see only its first version. The next section says what the levels are.
  • Release 8.0 starts at 8.0.1. Its first versions are 8.0.1, and for example 8.0.1-ea.0. No package is published as 8.0.0. The old 8.0.0-rc.N versions stay on npm for good, and a version such as 8.0.0-ea.0 would sort below them, so package managers would install an old release candidate in its place. From 8.1 on, every release starts at patch 0.

ADR 330 explains each of these rules in full.

Maturity levels

From release 8.0, every package published from this repository has one of four maturity levels: Generally Available (GA, a plain version such as 8.3.0), Release Candidate (8.3.0-rc.0), Preview (8.3.0-preview.0) and Early Access (8.3.0-ea.0). The policy says what each level promises. "Below GA" means any of the last three. Only what is GA is covered by What stays compatible.

Which packages are at which level

Each database has one package that your code imports from, such as @prisma/orm-postgres. That package is built from a few others, called the platform packages: @prisma/orm-framework (the core every database shares), @prisma/orm-toolchain (the prisma orm commands), a family package such as @prisma/orm-family-sql (what all SQL databases share), and a target package such as @prisma/orm-target-postgres (what is specific to one database).

At release 8.0:

What Level at release 8.0 Packages
PostgreSQL Generally Available @prisma/orm-postgres, @prisma/orm-target-postgres
The platform packages every database uses, and the family package for SQL databases Generally Available @prisma/orm-framework, @prisma/orm-toolchain, @prisma/orm-family-sql
PostgreSQL extensions Generally Available @prisma/orm-extension-pgvector, @prisma/orm-extension-postgis, @prisma/orm-extension-arktype-json, @prisma/orm-postgres-contrib
Query cache Generally Available @prisma/orm-extension-middleware-cache
Better Auth integration Generally Available @prisma/orm-better-auth
MongoDB Early Access @prisma/orm-mongo, @prisma/orm-family-mongo, @prisma/orm-target-mongo
MySQL Early Access @prisma/orm-mysql, @prisma/orm-target-mysql
MariaDB Early Access @prisma/orm-mariadb, @prisma/orm-target-mariadb
SQLite Early Access @prisma/orm-sqlite, @prisma/orm-target-sqlite
Supabase extension Early Access @prisma/orm-extension-supabase

No package is at Preview or Release Candidate yet. Each package's README states its level.

A function can be below its package's level

A GA package can contain a function that is not finished. Its name starts with its level, so you can see it where you call it:

db.orm.users.where({ email }).first()   // GA
db.orm.users.preview_search('ada')      // Preview: may still change

The level words are ea_, preview_ and rc_, capitalised for a type or a class (Preview_Search). When such a function moves up a level, it gets a new name and the old name keeps working, deprecated, until the next major version, unless the promotion also changes its parameters or what it returns: then the same release removes the old name. The policy's section on maturity levels has the rules.

What stays compatible

From release 8.0, an application built on what is GA upgrades to any later 8.x release with no changes: none to its code, none to the files Prisma generated for it, and none to its database. The same holds for an extension built on the GA platform packages. There are four exceptions, listed below and defined in the policy.

Some terms first. Your contract is the description of your data model. You write it in PSL, Prisma's contract language, or in TypeScript, and Prisma generates contract.json and a file of TypeScript types from it. The reference documentation is the precise description of each API, command, file format and error code.

Within a major version, the promise covers:

What The promise
The TypeScript API: types and import paths Code that compiles against one release compiles against every later one.
Behaviour and error codes Behaviour that the reference documentation describes does not change.
The contract you write A contract that one release accepts, every later release accepts.
Commands, the config file, and command output meant for programs, such as --json What works on one release works on every later one.
contract.json and the generated types Every later release reads them. You do not have to generate them again.
Migration files in your repository Every later release reads and applies them.
The tables Prisma keeps in your database, which record which contract the database matches and which migrations ran Every later release reads them.

Nothing that is GA is removed within a major. When something is replaced, the replacement arrives beside it, and the old form is marked deprecated and keeps working until the next major.

A later release may still change four kinds of thing: a bug, detail the reference documentation does not describe (such as the text of the SQL Prisma sends or the order of rows when you gave no orderBy), a security fix, even when it changes described behaviour, and support for a version of something Prisma runs on whose maker no longer supports it. The policy's section What may still change describes each one. Every release's notes list each change to behaviour.

What an application writes

prisma orm init writes the Prisma lines in your package.json. You do not have to work them out. It writes one line for the package you import from, and one for each platform package that one is built from. The platform packages are listed so that your application has exactly one copy of each; with two copies, Prisma fails with an error that is hard to trace (ADR 329). You never import them.

The number in each line is a range. ^8.3.0, with a caret, accepts 8.3.0 and any later 8.x version. ~8.3.0, with a tilde, accepts 8.3.0 and later fixes within 8.3, and nothing from 8.4.

What you do at a new release depends on the level of your database's package.

A GA database: update as usual

// a PostgreSQL application on release 8.3
"@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"

Every line has a caret. When release 8.4 is published, run your package manager's update command. Every line moves to 8.4 together, and you change nothing.

A new minor below GA

// a SQLite application on release 8.3; SQLite is at Early Access
"@prisma/orm-sqlite":        "~8.3.0-ea.0",
"@prisma/orm-target-sqlite": "~8.3.0-ea.0",
"@prisma/orm-framework":     "~8.3.0",
"@prisma/orm-family-sql":    "~8.3.0",
"@prisma/orm-toolchain":     "~8.3.0"

Every line has a tilde, so the whole application stays on 8.3 until you move it.

To move to release 8.4, edit every line to the new release and install:

"@prisma/orm-sqlite":        "~8.4.0-ea.0",
"@prisma/orm-target-sqlite": "~8.4.0-ea.0",
"@prisma/orm-framework":     "~8.4.0",
"@prisma/orm-family-sql":    "~8.4.0",
"@prisma/orm-toolchain":     "~8.4.0"

Then read the release notes, because a package below GA may have changed.

Why every line has a tilde, even the GA packages. A range never accepts a version with a level suffix from another release: ~8.3.0-ea.0 accepts 8.3.0-ea.1, but not 8.4.0-ea.0, and a caret would not either. So no update can move @prisma/orm-sqlite from 8.3 to 8.4. If the other lines had a caret, an update would move them to 8.4 and leave SQLite on 8.3. @prisma/orm-sqlite at 8.3 works only with the platform packages at 8.3, so the application would be left with a mix that was never tested. With a tilde on every line, that cannot happen. ADR 330 walks through this step by step.

Package managers rewrite these lines, so check them after an update.

  • pnpm writes an exact version for a package below GA, such as 8.3.0-ea.0 with no tilde, both when it adds the package and when it updates. An exact line never moves. To take a fix such as 8.3.0-ea.1, change the line yourself.
  • Yarn's command that updates to the latest version writes a caret. Change it back to a tilde.

An extension below GA in a GA application

A PostgreSQL application can use an extension that is still below GA, such as @prisma/orm-extension-supabase. After adding it, make sure its line has a tilde on its own version (a plain add writes a caret, or under pnpm an exact version):

"@prisma/orm-extension-supabase": "~8.3.0-ea.0"

Your other lines keep their carets, and you update as usual. This works where the SQLite case above does not, because an extension accepts every later release of the GA packages it is built on. After an update to 8.4 you still have the extension's 8.3 version, and it still works. To get its 8.4 version, edit that one line.

The prisma command-line tool

The prisma tool has version numbers of its own, because it brings together several tools and the ORM is only one of them. init installs it, and its line in package.json is not one of the lines above.

The tool depends on the ORM's packages at one exact version, and runs the ORM's commands from them. When you run an ORM command, your application's ORM packages must be that version. The tool is being changed to stop before an ORM command when your application has its own, separate copy of the ORM packages, naming both versions and where each is installed. It stops even when the two are the same version installed twice. Until it does, a mismatch shows up as an error that does not name the versions. If an ORM command starts failing after you update prisma, either move your application's Prisma lines to the version the tool carries, or install the prisma version you had before.

Installing a version that is not the newest stable one

Running npm install @prisma/orm-postgres with no version gives you the version under the npm tag latest.

Tag What it gives you
latest The newest GA version of a package. For a package that has never been GA, the newest version, whatever its level. Until release 8.0, the newest release candidate.
ea, preview, rc The newest version at that level, for a package that has already had a GA version. A plain install of such a package keeps giving you the last GA version.
dev A build of the newest commit on main, published on every push, such as 8.1.0-dev.4. Use it to check whether a fix that is not released yet solves your problem. Install every one of our packages with this tag. After a publish that failed part-way, packages can come from different builds, even at the same version, so use it to try a change, not as a fixed set. It may be removed at any time.

To try the change in one pull request, install its preview from pkg.pr.new. Install the preview of every Prisma package in your package.json together. A preview of one package installed alone runs on the released versions of the others, so it does not test the pull request.

For extension authors

Build your extension on the platform packages: @prisma/orm-framework, @prisma/orm-toolchain, @prisma/orm-family-* and @prisma/orm-target-*. List each one your code uses as a peer dependency, and again as a development dependency for your own build. Never depend on an @internal/* package; those are not published.

Which range to write on each:

Situation Range Example
Until release 8.0 One exact release candidate 8.0.0-rc.25
A GA package, and you use only its GA functions A caret on the first release your extension works with ^8.1.0
A GA package, and you use a function below GA, such as preview_search A tilde: that function may change in the next release ~8.1.0
A package below GA A tilde on its first version in that release ~8.1.0-ea.0

With a caret, your extension keeps working when an application moves to a later release, and you publish nothing. With a tilde, you publish a new version of your extension for each Prisma release.

At release 8.0, write ^8.0.1 and ~8.0.1-ea.0, never 8.0.0. No package is published at 8.0.0, and ~8.0.0-ea.0 would accept the old release candidates, because rc sorts after ea.

Version your own package as you see fit. We recommend taking the major and minor of the first Prisma release it works with, and using the same level suffixes. ADR 330 has the full convention, and the extension-upgrade reference has the steps.

Reporting a regression

If an upgrade within Prisma 8 breaks something that is GA, and it is not one of the four exceptions above, that is a bug. Open an issue with the two versions and the smallest example that shows it. The fix is published in the newest release.