Skip to content

v0.0.85

Choose a tag to compare

@justinvdm justinvdm released this 22 May 02:26
· 1281 commits to main since this release

What's Changed

Full Changelog: v0.0.84...v0.0.85

New Contributors

Support for Prisma >6.7

Usage of RedwoodSDK in this version with Prisma <6.7 should still work the same as before without any changes.

For upgrading Prisma, here's a migration guide based on how we've updated the standard starter

🔁 Prisma >6.7 migration guide for existing projects

Prisma introduced a new client generator (prisma-client) that lets us generate a client specific to Cloudflare workers (via workerd runtime) and ESM - this makes for much simpler and less error prone Vite integration.

This guide walks you through upgrading an existing RedwoodSDK Standard Starter project.

1. ✅ Update Dependencies

Update the following packages in your package.json:

-"rwsdk":"0.0.84",
- "@prisma/adapter-d1": "~6.5.0",
- "@prisma/client": "~6.5.0",
- "prisma": "~6.5.0",
+"rwsdk":"0.0.85",
+ "@prisma/adapter-d1": "~6.8.2",
+ "@prisma/client": "~6.8.2",
+ "prisma": "~6.8.2",

Also upgrade wrangler to at least ^4.16.0.

- "wrangler": "^4.14.1"
+ "wrangler": "^4.16.0"

Then make sure you've installed these packages, depending on your package manager:

npm install
# or
pnpm install
# or
yarn install

2. 🧬 Update schema.prisma

Change the generator block to use the new prisma-client:

-generator client {
-  provider        = "prisma-client-js"
-  previewFeatures = ["driverAdapters"]
-  output          = "../node_modules/.prisma/client"
+generator client {
+  provider = "prisma-client"
+  runtime = "workerd"
+  moduleFormat = "esm"
+  generatedFileExtension = "ts"
+  importFileExtension = "ts"
+  output = "../generated/prisma"
+  previewFeatures = ["queryCompiler", "driverAdapters"]
}

3. 🗂️ Adjust TypeScript Paths

In tsconfig.json:

- ".prisma/*": ["./node_modules/.prisma/*"]
+"@/*": ["./src/*"],
+ "@generated/*": ["./generated/*"]

Then update imports from @prisma/client to @/db.


4. 🛠️ Refactor DB Client Usage


5. 📁 Add to .gitignore

+generated/

6. 📦 Re-generate Client

After updating schema.prisma:

npx prisma generate

7. 🧪 Test Everything

Check your queries work in development and deployments.

⚠️ Trouble with @prisma/client import?

If you're seeing an error like this:

✘ [ERROR] Import "/path/to/project/@prisma/client/runtime/query_engine_bg.sqlite.wasm" not found. Does the file exist? [plugin vite:dep-scan]

generated/prisma/internal/class.ts:80:6:
  80 │       "@prisma/client/runtime/query_engine_bg.sqlite.wasm"
     ╵       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

…it may be due to having "baseUrl" set in tsconfig.json, which causes Vite to resolve @prisma/client via the @/* alias.

✅ Fix it by overriding the alias in vite.config.mts:

import path from "path";

export default defineConfig({
  resolve: {
    alias: {
      "@prisma/client": path.resolve(
        __dirname,
        "node_modules",
        "@prisma",
        "client"
      ),
    },
  },
});

More details on the problem and solution can be found here: emelleby/ilca-kns#1