Open SinPP opened 5 days ago
Hi @SinPP , thanks for filing this.
Unfortunately using fields from base model in unique constraint is not possible, because at Prisma level, the base and concrete models are distinct tables connected with a relation.
We can improve the checker to report an error for such usage.
Description and expected behavior I am trying to use polymorphic models. I have a base model and a model which extends the base model. I want to create a unique constraint on the extended model which includes a combination of the base model and the extend model. It fails with an error telling me that the field is not found on the extended model.
Screenshots
Environment (please complete the following information):
Additional context Error: Error validating model "Store": The unique index definition refers to the unknown fields: organizationId.