Skip to content

Commit d47cf7b

Browse files
Upgrade postgres-prisma example to prisma 7
1 parent 0aad1c1 commit d47cf7b

File tree

5 files changed

+3727
-1868
lines changed

5 files changed

+3727
-1868
lines changed

storage/postgres-prisma/lib/prisma.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
import { PrismaClient } from '@prisma/client'
1+
import { PrismaClient } from '../prisma/generated/client'
2+
import { PrismaPg } from '@prisma/adapter-pg'
23

34
declare global {
45
var prisma: PrismaClient | undefined
56
}
67

7-
const prisma = global.prisma || new PrismaClient()
8+
const adapter = new PrismaPg({
9+
connectionString: process.env.POSTGRES_PRISMA_URL!,
10+
})
11+
12+
const prisma =
13+
global.prisma ||
14+
new PrismaClient({
15+
adapter,
16+
})
817

918
if (process.env.NODE_ENV === 'development') global.prisma = prisma
1019

storage/postgres-prisma/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
"start": "next start",
1111
"lint": "next lint"
1212
},
13-
"prisma": {
14-
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
15-
},
1613
"dependencies": {
17-
"@prisma/client": "^5.4.1",
14+
"@prisma/adapter-pg": "6.20.0-integration-next.10",
15+
"@prisma/client": "6.20.0-integration-next.10",
1816
"@types/ms": "^0.7.32",
1917
"@types/node": "20.8.3",
2018
"@types/react": "18.2.25",
@@ -24,12 +22,17 @@
2422
"eslint-config-next": "13.5.4",
2523
"ms": "^2.1.3",
2624
"next": "13.5.4",
25+
"pg": "^8.16.3",
2726
"postcss": "8.4.31",
28-
"prisma": "^5.4.1",
27+
"prisma": "6.20.0-integration-next.10",
2928
"react": "18.2.0",
3029
"react-dom": "18.2.0",
3130
"tailwindcss": "3.3.3",
32-
"ts-node": "^10.9.1",
3331
"typescript": "5.2.2"
32+
},
33+
"devDependencies": {
34+
"@types/pg": "^8.15.6",
35+
"dotenv": "^17.2.3",
36+
"tsx": "^4.20.6"
3437
}
3538
}

0 commit comments

Comments
 (0)