Skip to content

Generation error when a delegate model has relation to another delegate model #1416

@ymc9

Description

@ymc9
model User {
  id   String @id @default(cuid())
  role String
}

model Price {
  id        String  @id @default(nanoid(6))
  entity    Entity? @relation(fields: [entityId], references: [id])
  entityId  String?
  priceType String
  @@delegate(priceType)
}

model MyPrice extends Price {
  foo String
}

model Entity {
  id    String  @id @default(nanoid(6))
  price Price[]
  type  String
  @@delegate(type)
}

model MyEntity extends Entity {
  foo String
}
    error: Error validating field `delegate_aux_MyPrice_entity_MyEntity` in model `MyPrice`: The relation field `delegate_aux_MyPrice_entity_MyEntity` on model `MyPrice` is missing an opposite relation field on the model `MyEntity`. Either run `prisma format` or add it manually.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions