How to make multiple fields in a type definition act as a single unique key?



So, I have specified the following types on which I wish to make the combination of both the name and label fields in the Size type definition be viewed as a single unique key. Is this possible?

type ItemVariant {
  id: ID! @unique
  item: Item @relation(name: "VariantssOfItem") #relationship to Item. 
  size: [Size!]! @relation(name: "SizesOfItemVariant" onDelete: CASCADE)
  color: Color!
  quantity: Int! @default(value: "1")
  image: String
  largeImage: String

type Size {
  id: ID! @unique
  name: String! @unique
  label: String @unique
  quantity: Int! @default(value: "1")
  itemvariant: ItemVariant @relation(name: "SizesOfItemVariant") #relationship to ItemVariant. 


This is not currently possible, but will be soon when datamodel v2 comes out.


Ok, many thanks. :+1:


This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.