epic-stack icon indicating copy to clipboard operation
epic-stack copied to clipboard

update prisma

Open AmanVarshney01 opened this issue 2 months ago • 2 comments


[!NOTE] Upgrades Prisma to 6.19 with a generated client/typed SQL, adds the Better SQLite3 adapter, and updates codebase imports/config accordingly.

  • Prisma upgrade & config
    • Switch generator to prisma-client with output in prisma/generated and enable typedSql in prisma/schema.prisma.
    • Introduce prisma.config.ts (schema, migrations path/seed, classic engine, DATABASE_URL).
    • Add Better SQLite3 adapter: use PrismaBetterSQLite3 and load env in app/utils/db.server.ts.
    • Update imports to #prisma/generated/client.ts and #prisma/generated/sql.ts; add #prisma/* path alias in package.json and ignore prisma/generated in .gitignore.
  • Dependencies
    • Bump Prisma packages to ^6.19.0; add @prisma/adapter-better-sqlite3.
  • App/tests
    • app/routes/users/index.tsx: use typed SQL via searchUsers.
    • Tests updated to import Prisma types from #prisma/generated/client.ts.

Written by Cursor Bugbot for commit 9ee75dc2e8e6e421b9ea4152224185697d88d6a8. This will update automatically on new commits. Configure here.

AmanVarshney01 avatar Nov 06 '25 18:11 AmanVarshney01

Currently it’s using a preview build of Prisma. You can try it out and let me know if everything works fine. The only change needed for Prisma 7 now is updating the dependencies to 7.0.0 😄

AmanVarshney01 avatar Nov 14 '25 11:11 AmanVarshney01

Awesome! I think I'll hold off until v7 is released. I think it's pretty close!

kentcdodds avatar Nov 14 '25 20:11 kentcdodds

a note here @AmanVarshney01 , something to look out for, as someone who did this myself on an existing application deployed to fly.io, if you use the DATABASE_URL="file:./data.db?connection_limit=1" it will crash the app because the ?connection_limit apparently is no longer supported, this is as prisma 7.0.1, it will say the tables don't exist.

The correct env variable to put on the .env.example file would be:

DATABASE_URL="file:./prisma/data.db"

Also I had to edit the Dockerfile to add the prisma.config.ts file like we do with the package.json:

ADD package.json prisma.config.ts package-lock.json .npmrc ./

...
COPY --from=build /myapp/prisma.config.ts /myapp/prisma.config.ts

luisiacc avatar Dec 03 '25 02:12 luisiacc