Repository navigation
Open
Labels
Area: APIapps/api (NestJS backend, Prisma models, CASL permissions)Area: Gatewayapps/gateway (patient-facing app for remote assignments)ChoreType: maintenance with no user-visible change (dependency upgrades, tooling, tests, refactors)Difficulty: Very HighMulti-week or architectural; needs a written design before implementationPriority: LowNice to have, cosmetic or speculativeUpstreamThe fix belongs in a @douglasneuroinformatics/* package or a third-party dependency
Description
The dependency update on the deps branch holds prisma and @prisma/client at 6.19.3, the last 6.x release, in apps/api and apps/gateway, and prisma-json-types-generator at 3.6.2. The newest releases eligible under the repo's 7-day minimumReleaseAge on 2026-10-04 were 7.10.0 and 5.1.1.
Why it was not upgraded
- libnest:
@douglasneuroinformatics/libnest@9.0.0peers@prisma/client ^6.9.0and depends on@prisma/engines ^6.19.2. - esbuild-plugin-prisma:
@douglasneuroinformatics/esbuild-plugin-prisma@1.0.1peersprisma,@prisma/clientand@prisma/enginesat5.x || 6.x. The gateway build uses it (apps/gateway/scripts/build.ts:5,32). - prisma-json-types-generator: 4.x peers Prisma
^7, and 5.x peers^7.8. 3.6.2 is the last release for Prisma 6. - MongoDB support: Prisma's v7 upgrade guide said v7 does not yet support MongoDB, and
apps/api/prisma/schema.prisma:12usesprovider = "mongodb". Check whether that still holds for the current 7.x. - Generator migration: v7 replaces the
prisma-client-jsgenerator, which both schemas use, withprisma-client. The new generator needs an explicitoutput, driver adapters and aprisma.config.ts.
What is required
- Confirm that Prisma 7 supports MongoDB.
- Release Prisma 7 support in libnest and in esbuild-plugin-prisma. The plugin may become unnecessary with the new generator and driver adapters.
- Migrate this repo:
- Move both schemas to the
prisma-clientgenerator and addprisma.config.ts. - Adopt a driver adapter for the gateway's SQLite database.
- Update every import of the generated clients.
- Bump
prisma-json-types-generatorto 5.x.
- Move both schemas to the
- Run
pnpm lint,pnpm testandpnpm test:e2e, plus production builds of api and gateway.
Metadata
Metadata
Assignees
Labels
Area: APIapps/api (NestJS backend, Prisma models, CASL permissions)Area: Gatewayapps/gateway (patient-facing app for remote assignments)ChoreType: maintenance with no user-visible change (dependency upgrades, tooling, tests, refactors)Difficulty: Very HighMulti-week or architectural; needs a written design before implementationPriority: LowNice to have, cosmetic or speculativeUpstreamThe fix belongs in a @douglasneuroinformatics/* package or a third-party dependency
Activity
joshunrau commentedon Oct 26, 2026
Still blocked on
main(d86740e), where both apps resolveprismaand@prisma/client6.19.3. For the API the title's target is wrong. Step 1 has an answer now: "Prisma ORM 7 has no MongoDB connector, so Prisma ORM 8 is the successor path" (v6 to v8 MongoDB guide). There is also a deadline. Prisma 6 gets security patches only until 19 November 2026, while Prisma 7 keeps getting them for 18 months after 8 goes GA (release status).The API needs Prisma 8, which is not ready
prisma's npmlatestis8.0.0-rc.27, and@prisma/orm-mongois at8.0.0-rc.20. MongoDB is "Early access", with transactions and extensions both "Not yet" (supported databases). The client becomesmongo({ contract, url, dbName })from@prisma/orm-mongo/runtime, so this is a rewrite, not a bump. Blockers the issue doesn't list:$transaction(apps/api/src/instrument-records/instrument-records.service.ts:169,apps/api/src/subjects/subjects.service.ts:146) becomesmongodbdriver sessions, with{ session }passed to every operation. Any operation that misses it silently runs outside the transaction. Item 5 of Performance: bulk record upload is N+1 on sessions and returns every record in the group #1414 would add a third use.$extends(LibnestPrismaExtension)(apps/api/src/core/prisma.ts:182) suppliesexists(), which has 7 call sites, and__modelName, which CASL subject detection reads (apps/api/src/auth/ability.utils.ts:14).omitkeepsuser.hashedPasswordout of reads, both globally (apps/api/src/core/prisma.ts:177-181) and per query inapps/api/src/users/users.service.ts. The v8 guide has noomit, so the port must exclude the hash some other way.$runCommandRawhas no v8 equivalent, soensureDatabaseIndexes(apps/api/src/core/prisma.ts:112,143,147),apps/api/src/demo/demo.service.ts:172andapps/api/src/setup/setup.service.ts:135need their ownMongoClient.@casl/prisma: 1.6.2 (main) and 2.0.2 (build: upgrade dependencies held back by breaking changes #1660) peer@prisma/clientup to^7.0.0, and both type conditions from@prisma/client'sPrisma.TypeMap.accessibleQueryneeds a CASL release for Prisma 8 or a replacement.Prisma.ModelNamefrom@prisma/clientat runtime (src/modules/prisma/prisma.module.ts:11andprisma.extensions.ts:24in 9.0.0). Its build plugin (src/meta/plugins/prisma.ts) throws when it finds nolibquery_engine-*.node. 10.0.0, which build: upgrade dependencies held back by breaking changes #1660 installs, still peers^6.9.0. The release libnest needs is for Prisma 8, not 7..env.template:25defaultsMONGODB_VERSION=7.0.prisma-json-types-generator: v8 replacesprisma generatewithprisma contract emit, and the guide's setup has nogeneratorblock. The/// [AuditLogMetadata]and/// [ComputedMeasures]typings (apps/api/prisma/schema.prisma:57,163) need another mechanism, so the bump to 5.x in step 3 does not apply.The gateway can move to Prisma 7 now
It doesn't use libnest or the JSON types generator, 7.10.1 supports SQLite, and patients reach it. The plan has these gaps:
docker-compose.yaml:86). The adapter needstimestampFormat: 'unixepoch-ms', which Prisma calls "Required for migrating from Prisma's native driver" (SQLite). Without it, the adapter misreads the storedcreatedAt/completedAt/expiresAt(apps/gateway/prisma/schema.prisma:17-19).@prisma/adapter-better-sqlite3is a new dependency and needs sign-off. It pulls inbetter-sqlite3, a native addon that needs anallowBuildsentry. The runner stage (apps/gateway/Dockerfile:26-37) shipsdist/withoutnode_modules, so the build has to carry the addon.db:pushpasses--skip-generate(apps/gateway/package.json:12), a flag Prisma 7 removed.apps/gateway/Dockerfile:24and the gateway build inturbo.jsonboth rundb:push.esbuild-plugin-prismarather than port it. It only copies the query engine (src/index.js:25-34in 1.0.1), and a Prisma 7 client has none. Remove along with it:apps/gateway/Dockerfile:33,binaryTargets(apps/gateway/prisma/schema.prisma:7), its catalog entry,apps/gateway/AGENTS.md:89-90,.agents/docs/packages/esbuild-plugin-prisma.md, and the "11 packages" lists inAGENTS.md:149-150and.agents/docs/packages/index.md:3,14.outputleavesnode_modules/@prisma/generated-client, update thedb:generateoutputs (turbo.json:18) and.agents/docs/architecture/testing-strategy.md:183.react19already has.Recommendation
unixepoch-ms, and removing the plugin. Land it after build: upgrade dependencies held back by breaking changes #1660, which also editsapps/gateway/package.jsonand the catalog. For tests, repoint the mock inapps/gateway/src/lib/__tests__/prisma.test.tsand add a unit test that the adapter getsunixepoch-ms. Runtesting/src/specs/gateway-assignment.spec.ts, and boot a production image against agateway.dbwritten by 6.19.3.@casl/prismaanswer.mongodb-memory-server11.3.0 already gives theapps/api/test/suite and the Playwright stack 8.2.6. Existing deployments must be on 7.0 withfeatureCompatibilityVersion"7.0"before switching (upgrade notes).Decision needed: is it acceptable to run the API on unpatched 6.19.3 after 19 November, until Prisma 8's MongoDB support is ready? The alternative is to use the
mongodbdriver directly (apps/api/package.json:51), which is a larger rewrite.Triage note written with Claude Code. Code references point at
main@d86740e.