错误:“ @ scalarList”的策略参数的有效值为:RELATION

HE *_*hao 3 graphql prisma prisma-graphql

@scalarList在运行pyramida部署后,程序会弹出->(策略参数的有效值是:RELATION。)。谁知道为什么?

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
}
Run Code Online (Sandbox Code Playgroud)
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
}
Run Code Online (Sandbox Code Playgroud)

Jul*_*ras 6

根据docs的说明,当我们需要将Fields创建为Array或List时,需要使用@scalarlist指令,在您的情况下,正确的模型定义应与表/列img一起使用

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
}
Run Code Online (Sandbox Code Playgroud)

文件连结-> https://www.prisma.io/docs/datamodel-and-migrations/datamodel-MYSQL-knul/#@scalarlist