Prisma datamodel.prisma дает несколько ошибок на модели - PullRequest
0 голосов
/ 01 мая 2020

Я учусь работать с GraphQl и Prisma, и я следую этому уроку -> https://www.howtographql.com/graphql-js/4-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`.  

Я не уверен, почему моя модель данных предоставляет эти ошибки, может кто-нибудь помочь мне с этой проблемой

1 Ответ

0 голосов
/ 01 мая 2020

У вас есть опечатка - это DateTime, а не DataTime.

...