As of now, if I have this schema:
datasource db {
provider = "sqlite"
url = "sqlite:./dev.db"
}
generator client {
provider = "prisma-client-js"
}
model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
author User?
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
And the column author in Post has the type text in any SQL database (vs. the Int that is expected via the User.id column), it won't error, but just can't resolve the relation, returning an empty result set.
We should either error in this situation or be able to coerce the type of the author column.
@timsuchanek
Before / After

Error is now
Reason: Error occurred during query execution:
InterpretationError("Error for binding \'0\': DomainError(ConversionFailure(\"record identifier\", \"assimilated record identifier\"))")
at PrismaClientFetcher.request (/Users/j42/Dev/prisma-examples/typescript/script/node_modules/@prisma/client/index.js:82:23)
DomainError(ConversionFailure(\"record identifier\", \"assimilated record identifier\"))
What does that mean?
@janpio Tim told the message should be better, here it's a regression from the engine, the error points out that the ID type is not correct. I'll run again soon as the backend is fixed it :)
This should be fixed now. Can you test again please @Jolg42 ? 馃檹
So it looks like from the Prisma Client there is no error provided like before.
Reproduction example:
Code and SQLite db from:
https://github.com/prisma/prisma-examples/tree/d84af887496a104aa94b214d6301dc4d80ddc266/typescript/script
yarn add prisma2@alpha @prisma/client@alpha
npx prisma2 generate
ts-node script.ts
Latest step of the scripts returns an empty array instead of data
Retrieved all posts from a specific user: []
Note: The SQLite database need to be reverted (or code modified) after each run because of the unique condition
DomainError(ConversionFailure("record identifier", "assimilated record identifier"))
What does that mean?
It's an internal error stating that one set of fields from a result (table A) can't be rolled over into the opposing sides fields (on table B, FK) because they mismatch.
@Jolg42 So you're saying it still doesn't work, am I reading this correctly?
@dpetrick : Yes the query engine returns an empty array when it should find related records instead.
Not reproducible, I assume this to be fixed through various merges concerning types and core query handling.
Indeed it works! 馃帄
Retrieved all posts from a specific user: [
{
id: 2,
title: 'Watch the talks from Prisma Day 2019',
content: 'https://www.prisma.io/blog/z11sg6ipb3i1/',
published: true
},
{
id: 5,
title: 'Join the Prisma Slack community',
content: 'http://slack.prisma.io',
published: true
}
]