Prisma datamodel.prisma在模型上给出了几个错误。

问题描述 投票:0回答:1

我正在学习使用GraphQl和prisma,我正在遵循这个教程--&gt。https:/www.howtographql.comgraphql-js4-adding-a-database

我按照它的方法,但是把链接改成了一个有名称字段和成本的服务(目前是一个字符串),我做了一个datamodel.prisma文件,看起来是这样的。

type Service {
    id: ID! @id
    createdAt: DataTime! @createdAt
    updatedAt: DataTime! @updatedAt
    name: String!
    cost: String!
}

但它给我这个错误,不明白它应该是正确的语法?

Errors:

  Service
    × The field `createdAt` has the type `DataTime!` but there's no type or enum declaration with that name.
    × The field `updatedAt` has the type `DataTime!` but there's no type or enum declaration with that name.
    × The relation field `createdAt` must specify a `@relation` directive: `@relation(name: "MyRelation")`
    × The relation field `updatedAt` must specify a `@relation` directive: `@relation(name: "MyRelation")`
    × Fields that are marked as `@createdAt` must be of type `DateTime!` or `DateTime`.    
    × Fields that are marked as @updatedAt must be of type `DateTime!` or `DateTime`.  

我不知道为什么我的数据模型会出现这些错误 有人能帮我解决这个问题吗?

graphql datamodel prisma prisma-graphql
1个回答
0
投票

你有一个错别字--是 DateTime,不 DataTime.

© www.soinside.com 2019 - 2024. All rights reserved.