Skip to content

chore(deps): update prisma to v7 (major)#2900

Merged
tobiasdiez merged 11 commits intorenovate/major-prismafrom
copilot/sub-pr-2898
Mar 4, 2026
Merged

chore(deps): update prisma to v7 (major)#2900
tobiasdiez merged 11 commits intorenovate/major-prismafrom
copilot/sub-pr-2898

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

🔗 Linked issue

📚 Description

Completes the Prisma v7 migration per the official upgrade guide.

Schema / generator

  • Remove url from datasource block in schema.prisma (no longer valid in v7)
  • Remove deprecated previewFeatures = ["queryCompiler", "driverAdapters"] (now stable/default)

prisma.config.ts

  • Add datasource block with url from NUXT_DATABASE_URL and optional shadowDatabaseUrl from NUXT_SHADOW_DATABASE_URL (only used for schema drift detection, kept separate to avoid prisma db push failing when shadow DB equals main DB)
  • Made conditional on env var presence so prisma generate works without a live DB (required for the lint CI job)
  • Add explicit migrations.path

nuxt.config.ts

  • Update GraphQL codegen User mapper: @prisma/client/index.d#User./database#User (model types are no longer exported from @prisma/client in v7; they live in the generated output)

package.json

  • prisma:migrate:diff: replace removed --to-schema-datamodel with --to-schema; drop --shadow-database-url CLI flag (now in prisma.config.ts)
  • Replace old unversioned prisma and @prisma/client patch entries with versioned prisma@7.4.2 and @prisma/client@7.4.2 entries

patches/

  • Add prisma@7.4.2.patch: replaces globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url)) with globalThis['__dirname'] = "DOESNOTEXIST" in the code generator template, fixing the Windows build error (File URL path must be absolute in prerendering)
  • Add @prisma__client@7.4.2.patch: adds throw t; at the start of handleRequestError in runtime/client.js and runtime/client.mjs (ported from the v6 patch with updated variable names)

CI (.github/workflows/ci.yml)

  • Add SHADOW_DATABASE_URL env var pointing to a separate jabref_shadow database
  • Add step to create the jabref_shadow database before schema drift detection (Prisma v7 no longer auto-creates the shadow database for migrate diff)
  • Inject NUXT_DATABASE_URL and NUXT_SHADOW_DATABASE_URL env vars into the drift-detection step

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Remove url from schema.prisma datasource (no longer supported)
- Remove deprecated previewFeatures from generator block
- Add datasource config to prisma.config.ts with conditional env var
- Add migrations.path to prisma.config.ts
- Update nuxt.config.ts User mapper to use generated client path
- Update prisma:migrate:diff script to use --to-schema (renamed flag)
- Remove --shadow-database-url CLI flag (now configured in prisma.config.ts)
- Update CI workflow to pass NUXT_DATABASE_URL to migrate:diff step

Co-authored-by: tobiasdiez <5037600+tobiasdiez@users.noreply.github.com>
Copilot AI changed the title [WIP] Update prisma to version 7 chore(deps): update prisma to v7 (major) Mar 3, 2026
@renovate renovate bot force-pushed the renovate/major-prisma branch from a3a13d4 to 35d892e Compare March 4, 2026 18:08
@tobiasdiez
Copy link
Copy Markdown
Member

@copilot Fix:

Run pnpm prisma:push
pnpm prisma:push
shell: /usr/bin/bash -e {0}
env:
DATABASE_URL: ***localhost:5432/jabref?schema=public
SESSION_PASSWORD: somerandompasswordNxFHaqCSPpBe6n5kRz2dru4hJ7K9bjgEtmsV8QAT3MDXcUfWGL
PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
NUXT_DATABASE_URL: ***localhost:5432/jabref?schema=public

jabref-online@1.0.0 prisma:push /home/runner/work/JabRefOnline/JabRefOnline
prisma db push

[dotenv@17.3.1] injecting env (0) from .env -- tip: ⚙️ override existing env vars with { override: true }
Loaded Prisma config from prisma.config.ts.

Prisma schema loaded from server/database/schema.prisma.
Datasource "db": PostgreSQL database "jabref", schema "public" at "localhost:5432"
Error: The shadow database you configured appears to be the same as the main database. Please specify another shadow database.

and during build (on windows)

Error: File URL path must be absolute
at getPathFromURLWin32 (node:internal/url:1484:11)
at fileURLToPath (node:internal/url:1609:35)
at /D:/a/JabRefOnline/JabRefOnline/node_modules/.cache/nuxt/.nuxt/prerender/chunks//nitro.mjs:3728:40
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:661:26)
at async prerender (/D:/a/JabRefOnline/JabRefOnline/node_modules/.pnpm/nitropack@2.12.9_patch_hash_e32fc50f8a4acfcfbf2418349f481213/node_modules/nitropack/dist/core/index.mjs:2038:44)
at async /D:/a/JabRefOnline/JabRefOnline/node_modules/.pnpm/@nuxt+nitro-server@4.2.0
@a_f21facf24721bdff4443eb68baa58840/node_modules/@nuxt/nitro-server/dist/index.mjs:773:5
at async build (/D:/a/JabRefOnline/JabRefOnline/node_modules/.pnpm/nuxt@4.2.0_@azure+identity@_951c82a00a36d0e30f34b78d482d2cd2/node_modules/nuxt/dist/index.mjs:6786:3)
at async Object.run (/D:/a/JabRefOnline/JabRefOnline/node_modules/.pnpm/@nuxt+cli@3.30.0_magicast@0.5.1/node_modules/@nuxt/cli/dist/build-CVr-ruAe.mjs:67:3)
at async runCommand (/D:/a/JabRefOnline/JabRefOnline/node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs:316:16)

This can be fixed by porting the patch to prisma to the new version.

- Remove shadowDatabaseUrl from prisma.config.ts when unused (was causing prisma:push to fail)
- Add NUXT_SHADOW_DATABASE_URL support as a separate env var for migrate:diff only
- Update CI: add SHADOW_DATABASE_URL env and step to create jabref_shadow database
- Update prisma.patch for v7.4.2 (fix fileURLToPath in generated ESM client code)
- Update @prisma/client patch for v7.4.2 (fix error re-throwing in runtime)
- Remove old unversioned patch entries (v6) from package.json patchedDependencies

Co-authored-by: tobiasdiez <5037600+tobiasdiez@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 4, 2026

@copilot Fix:

...

Fixed both issues in commit 36c01a1:

1. prisma:push shadow DB error:

  • Removed shadowDatabaseUrl from prisma.config.ts (it was unconditionally set to the same value as the main DB URL, causing prisma db push to fail)
  • Added a separate NUXT_SHADOW_DATABASE_URL env var that is only set for the migrate:diff step
  • Added a CI step to create the jabref_shadow database before schema drift detection (Prisma v7 no longer auto-creates the shadow DB for migrate diff)

2. Windows build fileURLToPath error:

  • Updated patches/prisma@7.4.2.patch: replaces globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url)) with globalThis['__dirname'] = "DOESNOTEXIST" in the code generator template (same fix as the old v6 patch, ported to the v7 package structure)
  • Updated patches/@prisma__client@7.4.2.patch: adds throw t; at the start of handleRequestError in the runtime (same fix as old v6 patch, with updated variable names for v7)
  • Removed old unversioned v6 patch entries (prisma and @prisma/client) from package.json

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 4, 2026

@tobiasdiez tobiasdiez marked this pull request as ready for review March 4, 2026 23:01
@tobiasdiez tobiasdiez merged commit d2d2c7b into renovate/major-prisma Mar 4, 2026
4 of 5 checks passed
@tobiasdiez tobiasdiez deleted the copilot/sub-pr-2898 branch March 4, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants