You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
512 B
21 lines
512 B
import { PrismaClient } from "@prisma/client";
|
|
declare let global: { prisma: PrismaClient };
|
|
|
|
// PrismaClient is attached to the `global` object in development to prevent
|
|
// exhausting your database connection limit.
|
|
//
|
|
// Learn more:
|
|
// https://pris.ly/d/help/next-js-best-practices
|
|
|
|
let prisma: PrismaClient
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
prisma = new PrismaClient()
|
|
} else {
|
|
if (!global.prisma) {
|
|
global.prisma = new PrismaClient()
|
|
}
|
|
prisma = global.prisma
|
|
}
|
|
export default prisma
|