1
0
mirror of synced 2025-12-19 18:11:23 -05:00
Files
blitz/examples/plain-js/db/index.js
Justin Hall b3814fc7c0 Standardize prettier options across all Blitz code bases (#703)
Co-authored-by: Brandon Bayer <b@bayer.ws> (meta)
2020-06-19 09:33:57 +07:00

16 lines
401 B
JavaScript

import {PrismaClient} from "@prisma/client"
export * from "@prisma/client"
let prisma
if (process.env.NODE_ENV === "production") {
prisma = new PrismaClient()
} else {
// Ensure the prisma instance is re-used during hot-reloading
// Otherwise, a new client will be created on every reload
global.prisma = global.prisma || new PrismaClient()
prisma = global.prisma
}
export default prisma