Hello, guys, I found unexpected behaviour of Prism...
# orm-help
m
Hello, guys, I found unexpected behaviour of Prisma, when I select count of nested entities. I attach request and error. I will be grateful for any ideas
j
The error is stating that a column that is defined in your prisma schema does not exist in your database. Have you run your migrations?
m
Yes of course, and then successfully compile my project
j
and you've confirmed you have a column
taskId
on the
aggr_selection_2_Task
table?
m
No. there is not
taskId
field For explain why, I attach screen with query from log, when Prisma run my query: So
MediaFile
table is table from I select count of nested entities.
_resultMediaFiles
is internal entities. which Prisma generate automaticly, based on my relation many to many between entities
MediaFile
and
Task
. So, table
_resultMediaFiles
has only
A
and
B
fields (respectively ids from nested entities –
MediaFile
and
Task
). And
taskId
is only in
Task
entity, which Prisma dont select at all in its query. So I don’t understand why the Prisma in runtime thinks that this field must exist
@Nurul could this be a bug?
n
Could you share your schema file? I am interested in seeing your mediaFile model
m
Yes
And also
Task
. Mb it can be useful.I highlighted the relationships that we are interested in
j
You have defined taskId as the ID on the Task table, and you stated that column doesn't exist in the table in the DB?
m
@Jared Fraser no.
taskId
exist in the table
Task
. But not exist in
MediaFile JOIN _resultMediaFiles
, from which Prisma try to select it
j
ah very interesting, yeah the intermediary join should be going off "internalFileId" on the aggregated join. Have you created a ticket on github
m
No
n
Can you please help me in reproducing this issue? If this repository is public, could you share it’s link?
m
@Nurul no, it’s not public unfortunately. But I can send you in private messages what you need and what I can within my authority