apps/docs/content/docs.v6/orm/more/upgrades/older-versions.mdx
This page provides upgrade guidance for older Prisma ORM versions. For upgrading to the current version, see Upgrade to v7.
Prisma ORM v6 introduced breaking changes related to Node.js versions, TypeScript versions, and schema changes for PostgreSQL.
fullTextSearchPostgres preview featureBuffer replaced with Uint8Array: For Bytes fieldsNotFoundError removed: Use PrismaClientKnownRequestError with code P2025 insteadnpm install prisma@6 @prisma/client@6
After upgrading, run prisma migrate dev --name upgrade-to-v6 to apply schema changes for implicit m-n relations.
Prisma ORM v5 introduced the JSON Protocol for improved performance and removed deprecated APIs.
rejectOnNotFound removed: Use findFirstOrThrow() or findUniqueOrThrow() insteadOR, in, notIn, and path now require array valuescockroachdb provider (not postgresql)rejectOnNotFound// Before (v4 and earlier)
prisma.user.findFirst({
where: { name: "Alice" },
rejectOnNotFound: true,
});
// After (v5+)
prisma.user.findFirstOrThrow({
where: { name: "Alice" },
});
// Before (v4 and earlier)
prisma.user.findMany({
where: { OR: { email: "[email protected]" } },
});
// After (v5+)
prisma.user.findMany({
where: { OR: [{ email: "[email protected]" }] },
});
npm install prisma@5 @prisma/client@5
Prisma ORM v4 made extended indexes generally available and introduced changes to raw queries and JSON null handling.
extendedIndexes preview feature removed@unique required: For 1:1 relationsDateTime returns Date, Numeric returns DecimalDbNull, JsonNull, AnyNull: Now objects instead of strings// Before (v3 and earlier)
prisma.log.findMany({
where: { data: { meta: { equals: null } } },
});
// After (v4+)
import { Prisma } from "@prisma/client";
prisma.log.findMany({
where: { data: { meta: { equals: Prisma.AnyNull } } },
});
npm install prisma@4 @prisma/client@4
After upgrading, run npx prisma db pull to retrieve existing index configurations before creating new migrations.
Prisma ORM v3 introduced referential actions and named constraints, with significant changes to cascade delete behavior.
$queryRaw changes: Only supports template literals (use $queryRawUnsafe for strings)Prisma.DbNull, Prisma.JsonNull, Prisma.AnyNullIn v2.x, Prisma Client prevented cascading deletes at runtime. In v3+, this is handled by the database. Review your schema's onDelete settings:
model Post {
id Int @id
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
authorId Int
}
After upgrading, run npx prisma db pull to sync constraint names, or run npx prisma migrate dev to update to Prisma's default naming convention.
npm install prisma@3 @prisma/client@3
The @prisma/codemods package helps automate code changes when upgrading:
npx @prisma/codemods <transform> <path>
Available transforms:
namespace - Update @prisma/client namespace changesfindUnique - Convert findOne to findUniqueto$ - Convert deprecated methods to $ prefixed versionsupdate-2.12 - Apply all transforms for 2.12 upgradeSee the codemods repository for more details.