Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions storage/postgres-prisma/lib/prisma.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from '../prisma/generated/client'
import { PrismaPg } from '@prisma/adapter-pg'

declare global {
var prisma: PrismaClient | undefined
}

const prisma = global.prisma || new PrismaClient()
const adapter = new PrismaPg({
connectionString: process.env.POSTGRES_PRISMA_URL!,
})

const prisma =
global.prisma ||
new PrismaClient({
adapter,
})

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

Expand Down
15 changes: 9 additions & 6 deletions storage/postgres-prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
"start": "next start",
"lint": "next lint"
},
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
},
"dependencies": {
"@prisma/client": "^5.4.1",
"@prisma/adapter-pg": "7.0.0",
"@prisma/client": "7.0.0",
"@types/ms": "^0.7.32",
"@types/node": "20.8.3",
"@types/react": "18.2.25",
Expand All @@ -24,12 +22,17 @@
"eslint-config-next": "13.5.4",
"ms": "^2.1.3",
"next": "13.5.4",
"pg": "^8.16.3",
"postcss": "8.4.31",
"prisma": "^5.4.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.3",
"ts-node": "^10.9.1",
"typescript": "5.2.2"
},
"devDependencies": {
"@types/pg": "^8.15.6",
"dotenv": "^17.2.3",
"tsx": "^4.20.6",
"prisma": "7.0.0"
}
}
Loading