Tom
04/04/2021, 12:33 PMexport const createFood = async (food: CreateFood) => {
const createdFood = await prisma.food.create({
data: food,
})
return createdFood
}
I imported it into my seed.ts with: import { createFood } from './../api/routes/foods'
And called it like this:
async function main() {
await createFood(food)
}
However if I run the seed command it never completes and always tells me Running ts-node "prisma/seed.ts" ...
I think there might be an issue with different prisma clients?Ryan
04/06/2021, 6:26 AMprisma
instance in used in createFood
is not being disconnected which is why the script never ends.Ryan
04/06/2021, 6:27 AMprisma.$disconnect()
explicitly or create a function in your seed file.Tom
04/09/2021, 5:18 AM