Hello, :raised_hands: I'm developing an app that n...
# orm-help
a
Hello, ๐Ÿ™Œ I'm developing an app that need to migrate database and generate an updated Prisma Client while running. I was able to migrate database and generate the client by calling the cli command using spawn function. The problem is that the PrismaClient instance is already in memory and is not updated with the new schema. Do you have some ideas about how to fix that?
๐Ÿ‘€ 1
n
Hey ๐Ÿ‘‹ If I understand correctly you are invoking
npx prisma generate
command through spawn function? But PrismaClient doesnโ€™t get updated? What output do you get when you invoke the prisma generate command?
a
npm WARN config global
--global`,
--local
are deprecated. Use
--location=global
instead.` Environment variables loaded from .env Environment variables loaded from prisma\.env Prisma schema loaded from prisma\schema.prisma โœ”๏ธ Generated Prisma Client (4.0.0 | library) to .\node_modules\@prisma\client in 168ms You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
Copy code
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
above is the output of
npx prisma generate
. but the client is not updated, so I can not use the latest generated client. I should do something like recreate the client, but which is the best way to do that (if is it possible)?
n
Your output suggests that PrismaClient is correctly generated, could you share a sample reproduction for this so that we could have a look and see what's causing the client to not update?
a
Sure, here you can find a sample repo to verify the behavior. https://github.com/alanstriglio/prisma-live-reload Let me know if you need further information. Thank you
๐Ÿ‘€ 1
n
Thanks for providing the reproduction repository. Iโ€™ll let you know in case I need any further information.
๐Ÿ‘ 1