fix(portal-bff): downgrade Prisma to 6.x for nestjs-prisma compatibility
Prisma 7 introduced two breaking changes that conflict with
nestjs-prisma 0.27.0:
1. The `prisma-client` provider (new default in Prisma 7) outputs
the typed client to a custom path declared in schema.prisma.
nestjs-prisma's PrismaService extends @prisma/client's runtime,
which boots through @prisma/client/default.js — that stub requires
`.prisma/client/default` in a sibling node_modules tree. Only the
legacy `prisma-client-js` generator populates that path.
2. PrismaClientOptions in Prisma 7 no longer exposes `datasourceUrl`
nor `datasources`. Connection now requires a driver adapter
(e.g. `@prisma/adapter-pg` for Postgres). nestjs-prisma 0.27.0
does not pass an adapter, and `new PrismaClient(undefined)` is
rejected with `PrismaClientInitializationError: PrismaClient needs
to be constructed with a non-empty, valid PrismaClientOptions`.
Both quirks are Prisma 7's adapter-first architecture surfacing
through a still-Prisma-6-shaped wrapper. nestjs-prisma's peer-deps
say `^7.0.0` but its design assumes the older API. Working around
each issue separately leads further into bespoke wiring (custom
PrismaService, manual @prisma/adapter-pg setup) — bricolage on a
foundational layer.
Per CLAUDE.md ("default to stable, recognized, battle-tested
choices"), downgrade to Prisma 6.19 (still actively maintained):
- package.json: prisma + @prisma/client pinned to ^6 (resolved 6.19.3)
- apps/portal-bff/prisma/schema.prisma:
- generator client: `prisma-client-js` (Prisma 6 default)
- datasource db: explicit `url = env("DATABASE_URL")` (required by
Prisma 6, was implicit in Prisma 7 via prisma.config.ts)
- apps/portal-bff/prisma.config.ts: removed (Prisma 7-only feature)
- apps/portal-bff/.gitignore: drop the now-irrelevant
`/generated/prisma` entry (no custom output dir with prisma-client-js)
ADR-0006 ("Persistence — PostgreSQL with Prisma") is unchanged: it
specifies Prisma without pinning a version. The version choice is a
tactical detail.
Re-evaluate when nestjs-prisma releases an update aligned with
Prisma 7's adapter model.
Verified: pnpm exec prisma generate populates Prisma 6's
.prisma/client/default.{js,d.ts}; pnpm nx build portal-bff green.
Runtime serve to be re-verified locally before merge.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
node_modules
|
||||
# Keep environment variables out of version control
|
||||
.env
|
||||
|
||||
/generated/prisma
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
// This file was generated by Prisma, and assumes you have installed the following:
|
||||
// npm install --save-dev prisma dotenv
|
||||
import "dotenv/config";
|
||||
import { defineConfig } from "prisma/config";
|
||||
|
||||
export default defineConfig({
|
||||
schema: "prisma/schema.prisma",
|
||||
migrations: {
|
||||
path: "prisma/migrations",
|
||||
},
|
||||
datasource: {
|
||||
url: process.env["DATABASE_URL"],
|
||||
},
|
||||
});
|
||||
@@ -4,10 +4,10 @@
|
||||
// Get a free hosted Postgres database in seconds: `npx create-db`
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../generated/prisma"
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
+2
-2
@@ -69,7 +69,7 @@
|
||||
"nx": "22.7.0",
|
||||
"postcss": "^8.5.12",
|
||||
"prettier": "^3.8.1",
|
||||
"prisma": "^7.8.0",
|
||||
"prisma": "^6.19.3",
|
||||
"tailwindcss": "^4.2.4",
|
||||
"ts-jest": "^29.4.0",
|
||||
"ts-node": "10.9.1",
|
||||
@@ -90,7 +90,7 @@
|
||||
"@nestjs/common": "^11.0.0",
|
||||
"@nestjs/core": "^11.0.0",
|
||||
"@nestjs/platform-express": "^11.0.0",
|
||||
"@prisma/client": "^7.8.0",
|
||||
"@prisma/client": "^6.19.3",
|
||||
"axios": "^1.6.0",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.15.1",
|
||||
|
||||
Generated
+120
-662
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user