Error: Valid values for the strategy argument of `@scalarList` are: RELATION
Error: Valid values for the strategy argument of `@scalarList` are: RELATION
程序弹出此 ->(@scalarList
的策略参数的有效值为:RELATION。)在 运行 prisma 部署之后。任何人都知道为什么?
type User {
id: ID! @id
name: String!
email: String! @unique
password: String!
age: Int
img: String
location: Location
hostedEvents: [Event]! @relation(name: "HostedEvents", onDelete: CASCADE)
joinedEvents: [Event]! @relation(name: "EventMembers", onDelete: CASCADE)
pushNotificationTokens: [PushNotificationTokens]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Event {
id: ID! @id
owner: User! @relation(name: "HostedEvents")
name: String!
imgs: [String]!
description: String
start: DateTime!
end: DateTime!
categories: [Category]!
members: [User]! @relation(name: "EventMembers")
chatRoom: GroupChatRoom!
pendingRequests: [PendingRequest]!
locations: [Location]!
comments: [Comment]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
根据文档,当我们需要将字段创建为数组或列表时,需要指令 @scalarlist 指令,在您的情况下,正确的模型定义应该是 table/column imgs
type Event {
id: ID! @id
owner: User! @relation(name: "HostedEvents")
name: String!
imgs: [String!]! @scalarList(strategy: RELATION)
description: String
start: DateTime!
end: DateTime!
categories: [Category]!
members: [User]! @relation(name: "EventMembers")
chatRoom: GroupChatRoom!
pendingRequests: [PendingRequest]!
locations: [Location]!
comments: [Comment]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
文档 link -> https://www.prisma.io/docs/datamodel-and-migrations/datamodel-MYSQL-knul/#@scalarlist
程序弹出此 ->(@scalarList
的策略参数的有效值为:RELATION。)在 运行 prisma 部署之后。任何人都知道为什么?
type User {
id: ID! @id
name: String!
email: String! @unique
password: String!
age: Int
img: String
location: Location
hostedEvents: [Event]! @relation(name: "HostedEvents", onDelete: CASCADE)
joinedEvents: [Event]! @relation(name: "EventMembers", onDelete: CASCADE)
pushNotificationTokens: [PushNotificationTokens]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Event {
id: ID! @id
owner: User! @relation(name: "HostedEvents")
name: String!
imgs: [String]!
description: String
start: DateTime!
end: DateTime!
categories: [Category]!
members: [User]! @relation(name: "EventMembers")
chatRoom: GroupChatRoom!
pendingRequests: [PendingRequest]!
locations: [Location]!
comments: [Comment]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
根据文档,当我们需要将字段创建为数组或列表时,需要指令 @scalarlist 指令,在您的情况下,正确的模型定义应该是 table/column imgs
type Event {
id: ID! @id
owner: User! @relation(name: "HostedEvents")
name: String!
imgs: [String!]! @scalarList(strategy: RELATION)
description: String
start: DateTime!
end: DateTime!
categories: [Category]!
members: [User]! @relation(name: "EventMembers")
chatRoom: GroupChatRoom!
pendingRequests: [PendingRequest]!
locations: [Location]!
comments: [Comment]!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
文档 link -> https://www.prisma.io/docs/datamodel-and-migrations/datamodel-MYSQL-knul/#@scalarlist