-
Notifications
You must be signed in to change notification settings - Fork 23
Upgrade to prisma v7 #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Upgrade to prisma v7 #104
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,3 +33,4 @@ yarn-error.log* | |
|
|
||
| # turbo | ||
| .turbo | ||
| packages/db/prisma/generated | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| "moduleResolution": "node", | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "jsx": "preserve", | ||
| "jsx": "react-jsx", | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this happened automatically, is it correct?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no idea |
||
| "incremental": true, | ||
| "plugins": [ | ||
| { | ||
|
|
@@ -28,7 +28,8 @@ | |
| "next-env.d.ts", | ||
| "**/*.ts", | ||
| "**/*.tsx", | ||
| ".next/types/**/*.ts" | ||
| ".next/types/**/*.ts", | ||
| ".next/dev/types/**/*.ts" | ||
| ], | ||
| "exclude": [ | ||
| "node_modules" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,15 +14,17 @@ | |
| "postinstall": "prisma generate" | ||
| }, | ||
| "dependencies": { | ||
| "@prisma/client": "^6.8.2" | ||
| "@prisma/adapter-pg": "^7.0.0", | ||
| "@prisma/client": "^7.0.0" | ||
| }, | ||
| "prisma": { | ||
| "seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts" | ||
| }, | ||
| "devDependencies": { | ||
| "jest": "^29.7.0", | ||
| "prisma": "^6.8.2", | ||
| "tsup": "^8.4.0", | ||
| "typescript": "^5.8.3" | ||
| "dotenv": "^17.2.3", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is prisma not coming with it anymore? |
||
| "jest": "^30.2.0", | ||
| "prisma": "^7.0.0", | ||
| "tsup": "^8.5.1", | ||
| "typescript": "^5.9.3" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import "dotenv/config"; | ||
| import { defineConfig, env } from "prisma/config"; | ||
|
|
||
| export default defineConfig({ | ||
| schema: "prisma/schema.prisma", | ||
| migrations: { | ||
| seed: "tsx prisma/seed.ts", | ||
| }, | ||
| datasource: { | ||
| url: env("DATABASE_URL"), | ||
| }, | ||
| }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. awesome |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,23 @@ | ||
| import { PrismaClient } from "@prisma/client"; | ||
| import { PrismaClient } from "./generated/client"; | ||
| import { PrismaPg } from "@prisma/adapter-pg"; | ||
| import { readReplicas } from "@prisma/extension-read-replicas"; | ||
|
|
||
| const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interesting, PrismaPg does indeed have slightly more flexibility, what was your reason for?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or is the adapter required now? |
||
|
|
||
| declare global { | ||
| var prismaClient: PrismaClient; | ||
| } | ||
|
|
||
| export const prismaClient: PrismaClient = | ||
| export const prismaClient = | ||
| global.prismaClient || | ||
| new PrismaClient({ | ||
| adapter, | ||
| errorFormat: "pretty", | ||
| }); | ||
|
|
||
| if (process.env.NODE_ENV !== "production") global.prismaClient = prismaClient; | ||
|
|
||
| export const prismaReadClient = prismaClient | ||
| export const prismaReadClient = new PrismaClient({ adapter }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mmmh, I think it should extend the primary client, unless things have changed? |
||
| .$extends( | ||
| readReplicas({ | ||
| url: process.env.DATABASE_URL, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,11 +2,11 @@ | |
| // learn more about it in the docs: https://pris.ly/d/prisma-schema | ||
| datasource db { | ||
| provider = "postgresql" | ||
| url = env("DATABASE_URL") | ||
| } | ||
|
|
||
| generator client { | ||
| provider = "prisma-client-js" | ||
| provider = "prisma-client" | ||
| output = "generated" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any better idea for an output path?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fine |
||
| previewFeatures = ["fullTextSearchPostgres"] | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,20 +41,20 @@ | |
| }, | ||
| "dependencies": { | ||
| "axios": "^1.13.2", | ||
| "deverything": "^4.2.1" | ||
| "deverything": "^4.5.0" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks |
||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "7.28.3", | ||
| "@babel/preset-env": "^7.28.3", | ||
| "@babel/preset-typescript": "^7.27.1", | ||
| "@babel/core": "7.28.5", | ||
| "@babel/preset-env": "^7.28.5", | ||
| "@babel/preset-typescript": "^7.28.5", | ||
| "@changesets/cli": "^2.29.7", | ||
| "@types/jest": "^30.0.0", | ||
| "@types/node": "^24.3.0", | ||
| "@types/node": "^24.10.1", | ||
| "eslint-config-custom": "workspace:*", | ||
| "jest": "^30.0.5", | ||
| "react-admin": "^5.10.1", | ||
| "jest": "^30.2.0", | ||
| "react-admin": "^5.13.2", | ||
| "ts-node": "^10.9.2", | ||
| "tsup": "^8.5.0", | ||
| "typescript": "^5.9.2" | ||
| "tsup": "^8.5.1", | ||
| "typescript": "^5.9.3" | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's quite many files, but should usually be checked in to git. How about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked in hmmm no I wouldn't, same for the https://www.npmjs.com/package/prisma-client-types-generator we've made, I do not check generated types in