Closed joaquimnetocel closed 1 year ago
I temporarily solved by manually generating the dmmf with this function (you can automate this to happen before nexus generation with a script command in package.json
):
import { getDMMF } from "@prisma/internals"
import fs from "fs"
const run = async () => {
const schema = fs.readFileSync(`${__dirname}/../../../prisma/schema.prisma`, {
encoding: "utf-8",
})
const dmmf = await getDMMF({ datamodel: schema })
fs.writeFileSync(`${__dirname}/dmmf.json`, JSON.stringify(dmmf, null, 2))
}
run()
and then passing the result to the paljs plugin settings:
// This file was generated from the previous step
import dmmfJSON from "./dmmf.json"
const nexusSchema = makeSchema({
types: myGeneratedTypes,
plugins: [
paljs({
dmmf: [JSON.parse(JSON.stringify(dmmfJSON))],
}),
],
outputs: {
...
},
contextType: {
...
},
})
This is just a temporary fix while hopefully paljs gets upgraded.
This issue request is in #284
The "sdlInputs.ts" is not working because of changes in prisma 4.
As pointed here, Prisma no longer exports Prisma.dmmf.schema into the generated Prisma Client.
I don't know if it helps, but the new getDMMF function can be imported with:
import { getDMMF } from "@prisma/internals/dist/engine-commands";
I thought about making a pull request, but as getDMMF is an asynchronous function, I don't know the best way to solve the problem.