Hi. Just had a quick question. Let's say I establi...
# orm-help
v
Hi. Just had a quick question. Let's say I establish a unique relation like this combining multiple fields and I call the combined field name as `key`:
@@unique([field1, field2], name: "key")
Now, is it possible to relate to
key
from other models like
@relation(fields: [field3], references: [key])
Currently it says that I can only map to fields that exist if I do this
j
The
@@unique
only constructs a unique constraint. The
@relations
needs to reference a field or combination of fields though. The
key
is not a real thing you can refer to here.
👍 1
v
Got it. Thanks. Was wondering how to refer to the combined key
j
Yeah, as this does not really require a "key" to be present we just use the underlying fields (as does SQL).