3

运行prisma generate我在此输出中出现,并且没有生成任何代码。

prisma generate
Generating schema...
[ { species: { type: [Object], args: [Object] } },
  { species: { type: [Object], args: [Object] },
Generating schema !
 !    Field configuration to merge has duplicate field names.

我的架构有什么问题?

type User {
  id: ID! @unique
  email: String! @unique
  name: String!
  password: String!
  entries: [Entry!]!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Language {
  id: ID! @unique
  language: String! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
}

type EntryScientificName {
  id: ID! @unique
  entry: Entry!
  isMain: Boolean!
  scientificName: String! @unique
  language: Language!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type EntryName {
  id: ID! @unique
  entry: Entry!
  isMain: Boolean!
  name: String! @unique
  Language: Language!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Species {
  id: ID! @unique
  species: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Genus {
  id: ID! @unique
  genus: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Family {
  id: ID! @unique
  family: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Order {
  id: ID! @unique
  order: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Habitat {
  id: ID! @unique
  habitat: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Month {
  id: ID! @unique
  month: String! @unique
}

type Anthesis {
  id: ID! @unique
  entry: Entry
  fromMonth: Month! @relation(name: "FromMonth")
  toMonth: Month! @relation(name: "ToMonth")
  note: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Nation {
  id: ID! @unique
  nation: String! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Region {
  id: ID! @unique
  nation: Nation!
  region: String! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
}

type DistributionDetail {
  id: ID! @unique
  detail: String!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type GeographicDistribution {
  id: ID! @unique
  entry: Entry!
  region: Region!
  detail: DistributionDetail
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Altitude {
  id: ID! @unique
  entry: Entry! @unique
  altitudeFrom: Int! @unique @constraint(min: -10894, max: 408000)
  altitudeTo: Int! @unique @constraint(min: -10894, max: 408000)
}

type Entry {
  id: ID! @unique
  name: [EntryName!]!
  scientificName: [EntryScientificName!]!
  species: Species
  genus: Genus
  family: Family
  order: Order
  biologicalForm: String
  plantDescription: String
  leafDescription: String
  flowerDescription: String
  fruitDescriptio: String
  chorologicalType: String
  habitat: [Habitat!]!
  geographicDistribution: [GeographicDistribution!]!
  altitude: [Altitude!]!
  etymology: String
  propertiesUses: String
  curiosities: String
  notes: String
  links: [Link!]!
  entryPicture: String
  draft: Boolean @default(value: "true")
  published: Boolean @default(value: "false")
  toBeReviewed: Boolean @default(value: "false")
  createdAt: DateTime!
  updatedAt: DateTime!
  author: User
}

type Link {
  id: ID! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
  url: String!
  description: String!
  postedby: User
}
4

1 回答 1

4

Prisma 根据您的数据模型生成 GraphQL 模式。这样做,它会根据您的类型生成多个类型。

但是,由于 is 的复数形式SpeciesSpeciesPrisma 现在有两种同名类型,因此会引发错误。(请参阅与 相同的问题News

您目前无法为类型或字段选择复数名称(请参阅问题)。

为您的类型仅使用单数名称通常是一个很好的建议。

于 2018-12-09T20:45:57.657 回答