Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ymc9 opened this issue May 8, 2024 · 1 comment
Closed
Milestone

Comments

@ymc9
Copy link
Member

ymc9 commented May 8, 2024

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.
@ymc9 ymc9 added this to the v2.1.0 milestone May 8, 2024
@ymc9
Copy link
Member Author

ymc9 commented May 13, 2024

Fixed in 2.1.0

@ymc9 ymc9 closed this as completed May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant