Created
March 4, 2024 19:22
-
-
Save codigoconjuan/d5be3dea3a3fb38eb7bd6e2cdcb9d7f4 to your computer and use it in GitHub Desktop.
Cliente de Conexiones Prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PrismaClient } from '@prisma/client' | |
const globalForPrisma = global as unknown as { prisma: PrismaClient } | |
export const prisma = | |
globalForPrisma.prisma || | |
new PrismaClient({ | |
log: ['query'], | |
}) | |
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma |
gracias
Thanks
hola ya Prisma en su documentación aporta este otro por si a alguien tiene algún problema
https://www.prisma.io/docs/guides/prisma-orm-with-nextjs
import { PrismaClient } from '@prisma/client'
import { withAccelerate } from '@prisma/extension-accelerate'
const prisma = new PrismaClient().$extends(withAccelerate())
const globalForPrisma = global as unknown as { prisma: typeof prisma }
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
export default prisma
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gracias profe