github prisma/orm v8.0.0-rc.10

pre-releaseone hour ago

v8.0.0-rc.10

This RC finishes the rename from Prisma Next to Prisma 8 in every identifier a project can see (the old schema header keeps working, the old environment variables do not), adds named model and result types to the emitted contract, makes db sign set the db ref so the first plan after adoption stays incremental, and adds attribute completion to the language server.

Breaking changes

  • CLI environment variables lose the NEXT_ infix. PRISMA_NEXT_DISABLE_TELEMETRY, PRISMA_NEXT_TELEMETRY_ENDPOINT, PRISMA_NEXT_DEBUG, and the rest are now PRISMA_DISABLE_TELEMETRY, PRISMA_TELEMETRY_ENDPOINT, PRISMA_DEBUG, and so on. Only the old PRISMA_NEXT_DISABLE_TELEMETRY opt-out is still honoured; rename the others in shell profiles, .env files, and CI. The per-user telemetry config moves from ~/.config/prisma-next/ to ~/.config/prisma-8/, so the one-time telemetry notice prints once more. orm init now writes its primer as prisma-8.md instead of prisma-next.md. See the app upgrade recipe. (#30262)

  • To-one relations record their nullability in the contract. Every 1:1 and N:1 relation in contract.json now carries a nullable boolean taken from the ? on the relation field, and contract emit rejects a required relation field over a nullable foreign key (or the reverse). Run prisma contract emit once after upgrading: a contract emitted by an earlier release still loads, with the flag derived from the foreign-key columns, but its contract.d.ts lacks the new Models namespace until you re-emit. Extension authors: ContractNonJunctionRelation's '1:1' and 'N:1' members require nullable, contract validation rejects a contract.json without it, and every contract space needs a rebuild. See the app upgrade recipe and the extension upgrade recipe. (#30231)

    Before:

    { "cardinality": "N:1", "on": { "...": "..." } }

    After:

    { "cardinality": "N:1", "nullable": false, "on": { "...": "..." } }

Features

  • The schema header is now // use prisma-8, and // use prisma-next is deprecated. orm init and contract infer write the new header. The old one still works: contract emit never reads the header, and the language server still recognises it and rewrites it to the new form when you format the file. Replace it at your convenience; the app upgrade recipe does it for you. (#30262)

  • Named model and result types. contract.d.ts exports a Models namespace and a models constant with one member per model (Models.public_User, or typeof models.public.User; bare names on SQLite). Scalars<M> names the row a default fetch returns, Shape<M, Spec> derives a data structure with chosen scalars and nested relations, and ResultType now works on ORM queries instead of returning never. Both come from @prisma/orm-postgres/family-contract/types (or the @prisma/orm-mongo equivalent). These replace Prisma 7's Prisma.User and UserGetPayload<...>. (#30231)

    import type { Models } from './prisma/contract';
    import type { Scalars, Shape } from '@prisma/orm-postgres/family-contract/types';
    import type { ResultType } from '@prisma/orm-postgres/components/runtime';
    
    type UserRow = Scalars<Models.public_User>;
    type UserResponse = Shape<Models.public_User, { '-': 'passwordHash'; posts: { '+': 'id' | 'title' } }>;
    const usersWithPosts = db.orm.public.User.include('posts');
    type UserWithPosts = ResultType<typeof usersWithPosts>;
  • Attribute completion in the language server. Editors now complete field, model, and block attribute names and their named argument keys from the installed target and extensions, and insert required arguments as editable snippets where the editor supports them. (#30249)

  • db sign can choose or skip the ref it advances. --advance-ref <name> writes another ref than db, --no-advance-ref signs without writing any ref or snapshot, and --json output gains advancedRef: { name, hash } (or null). (#30251)

Fixes

  • After db sign, migration plan proposes only the change instead of recreating every table. db sign now sets the db ref to the signed contract, even when the database is named with --db, so adopting an existing database no longer needs a baseline plan, a second sign, and a manual migration ref set. When no ref is set and no migrations exist, migration plan prints a notice that it is planning from an empty database, and --json gains fromDefaulted: true. (#30251)
  • Buffered PostgreSQL queries release their pooled connection before rows are decoded or consumed, so a paused result iterator no longer holds a connection and blocks other queries on a small pool. Cursor streams keep their connection until completion; caller-owned connections and transactions are untouched. (#30259)
  • orm init installs prisma@latest instead of prisma@next, a dist-tag that no longer exists, so a fresh orm init completes its install step again. The engine fallback is @prisma/cli-engine@latest. (#30248)
  • The bundled prisma-8 agent skill matches the rc.9 surface again: a review of every reference file corrected 21 statements that no longer matched the CLI or runtime, and the sample projects are keyed by namespace. (#30250)

Don't miss a new orm release

NewReleases is sending notifications on new releases.