update prisma
[!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-clientwith output inprisma/generatedand enabletypedSqlinprisma/schema.prisma.- Introduce
prisma.config.ts(schema, migrations path/seed, classic engine,DATABASE_URL).- Add Better SQLite3 adapter: use
PrismaBetterSQLite3and load env inapp/utils/db.server.ts.- Update imports to
#prisma/generated/client.tsand#prisma/generated/sql.ts; add#prisma/*path alias inpackage.jsonand ignoreprisma/generatedin.gitignore.- Dependencies
- Bump Prisma packages to
^6.19.0; add@prisma/adapter-better-sqlite3.- App/tests
app/routes/users/index.tsx: use typed SQL viasearchUsers.- 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.
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 😄
Awesome! I think I'll hold off until v7 is released. I think it's pretty close!
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