fe312ed4bd
Changes from https://github.com/planetscale/nextjs-starter. Realized the current example was not only out of date, but the demo was broken. Will update the demo site post-merge here 👍
14 lines
260 B
JavaScript
14 lines
260 B
JavaScript
import { PrismaClient } from '@prisma/client'
|
|
|
|
let prisma
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
prisma = new PrismaClient()
|
|
} else {
|
|
if (!global.prisma) {
|
|
global.prisma = new PrismaClient()
|
|
}
|
|
prisma = global.prisma
|
|
}
|
|
|
|
export default prisma
|