我在graphql / prisma上有我的应用程序的后端,我需要创建一个字段-createdAt:DateTime! datamodal.prisma中的@createdAtin用于在服务器上继续创建日期。根据官方文件-https://www.prisma.io/docs/1.34/datamodel-and-migrations/datamodel-MYSQL-knul/。但是我无法启动服务器,因为有错误:字段createdAt:在任何模式中都找不到类型DateTime。有人可以解释我在做什么吗?
datamodel.prisma
type Channel {
id: ID! @id
createdAt: DateTime! @createdAt
title: String!
cover: String!
stars: Int
creator: User! @relation(name: "ChannelToUser", onDelete: SET_NULL)
topics: [Topic!]! @relation(name: "TopicToChannel", onDelete: CASCADE)
}
type Message {
id: ID! @id
text: String!
createdAt: DateTime! @createdAt
creator: User! @relation(name: "MessageToUser", onDelete: SET_NULL)
topic: Topic! @relation(name: "MessageToTopic", onDelete: SET_NULL)
}
type Topic {
id: ID! @id
createdAt: DateTime! @createdAt
title: String!
stars: Int
avatar: String!
creator: User! @relation(name: "TopicToUser", onDelete: SET_NULL)
channel: Channel! @relation(name: "TopicToChannel", onDelete: SET_NULL)
messages: [Message!]! @relation(name: "MessageToTopic", onDelete: CASCADE)
}
type RefreshToken {
id: ID! @id
token: String!
owner: User! @relation(name: "RefreshTokenToUser", onDelete: SET_NULL)
}
type User {
id: ID! @id
createdAt: DateTime! @createdAt
name: String
email: String
stars: Int
phone: String! @unique
cover: String!
avatar: String!
channels: [Channel!]! @relation(name: "ChannelToUser", onDelete: CASCADE)
topics: [Topic!]! @relation(name: "TopicToUser", onDelete: CASCADE)
messages: [Message!]! @relation(name: "MessageToUser", onDelete: CASCADE)
refreshTokens: [RefreshToken!]! @relation(name: "RefreshTokenToUser", onDelete: CASCADE)
}