hello, is it possible to say that a field can be 1...
# orm-help
d
hello, is it possible to say that a field can be 1 or more relations? example
Copy code
referenceId Int

========
model A

model B

model C
how can I say that
referenceId
can be either
A
,
B
or
C
r
@Dev__ 👋 Unfortunately not possible. There’s a feature request similar to your use case that you can add a 👍 on.
d
so the alternative would be doing this without specifying a relation?
r
If you don’t specify a relation, you would need to fetch data from the other model manually. You won’t be able to use
include
in Prisma as that relies on relations.
d
yes, but I dont see any alternative? any suggestions?
r
Not that I know of. You can keep all three of these relations optional and fetch all of them but only one will be connected. @Dominic Hadfield Is there a better solution to this?
d
yeah thats also an option but I dont like the idea there will be fields that are
null
😅
r
Yeah
d
i ended up doing what you suggested 😄
d
@Ryan what you suggested is the only option at this point
👍 1