import { PrismaClient } from '@prisma/client' ; let db ; if ( process . env . NODE_ENV === 'production' ) { db = new PrismaClient ( ) ; console . log ( 'Production: Created DB connection.' ) ; } else { if ( ! global . db ) { global . db = new PrismaClient ( ) ; console . log ( 'Development: Created DB connection.' ) ; } db = global . db ; } db . $executeRaw ( 'PRAGMA foreign_keys = ON' ) ; export default db ;