@@unique block attribute fails for non-scalar types (regression)
See original GitHub issueBased on the following snippet from the PSL spec, @@unique
should work fine for non-scalar types:
@@unique([recipe, ingredient])
would mean that the combination of fields must be unique in the table:
model RecipeIngredient {
recipe Recipe
ingredient Ingredient
amount Float
quantitativeDisclosures String
comment String
@@unique([recipe, ingredient])
}
The semantic meaning seems intuitive here and implies a comparison based on the @id
field of the Recipe
and Ingredient
objects. As of 2.0.0-preview017.2
, this was working but some time after that point started failing with a panic as described in #1352. #1352 was closed in favor of #1377, but @janpio mentioned #1377 covers improving the error message but not the regression.
I know nothing about Rust, but https://github.com/prisma/prisma-engine/pull/241 looks like a likely root cause to me. The timing is about right and it seems like all of the tests expect that fields passed to @@unique
are scalar.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (9 by maintainers)
Week has gone, I did not get to update the issues yet. Work is still ongoing on the problem itself but we are making progress.
This is now cleaned up with additional issue https://github.com/prisma/prisma2/issues/1534 which is marked as a regression.