问题描述
我从棱镜1迁移了我的项目。 然后,我添加了相对于Live模型的新模型。 我尝试使用关系类型(一对一和一对多)查询新模型,但是返回空值。
这是我的prisma.schema
查询live.questionnaire {}有效,但问卷调查.live {}不起作用,问卷调查表.questionnaireField {}和问卷调查表.questionnaire {}都不会出错。
这里是游乐场的一个例子
我的模式
我的查询解析器,仅在createdAt起作用
如果有人可以帮助,谢谢
解决方法
看不清您的解析器,但我将为您提供一种使用Pal.Js CLI在几分钟内使用Prisma来构建GraphQL服务器的方法,您可以使用我的CLI启动新项目,只需放置架构并运行一个命令{{ 1}},您将使用完整的CRUD系统为您做好一切准备。
安装我的CLI
pal g
开始新项目
yarn global add @paljs/cli
//or
npm install -g @paljs/cli
现在打开您的项目文件夹,并用您的文件夹更改> pal c
.______ ___ __ __ _______.
| _ \ / \ | | | | / |
| |_) | / ^ \ | | | | | (----`
| ___/ / /_\ \ | | .--. | | \ \
| | / _____ \ | `----.| `--' | .----) |
| _| /__/ \__\ |_______| \______/ |_______/
✔ Please select your start example · apollo-sdl-first
full-stack-nextjs
full-stack-gatsbyjs
apollo-nexus-schema
❯ apollo-sdl-first // select this example
graphql-modules
✔ please enter your project name · great-project
✔ please enter your project description · new NodeJs Prisma GraphQL TypeScript project
✔ please enter your project author · Ahmed Elywa
✔ please enter your project repository · https://github.com/paljs/prisma-tools
✔ please select your package manager · yarn
❯ yarn
npm
✔ Skip package installation · no
❯ yes
no
文件
现在生成所有解析器
./prisam/schema.prisma
您现在已经准备好graphql服务器
启动服务器
pal g
就是这样