Closed tingfeng-key closed 1 year ago
For those that are having this issue, it seems the bug exists for create_many
but not for create
so I solved by looping inside a ._transaction()
call like this:
// Save to db
prisma_client
._transaction()
.run(|client| async move {
for apr in aprs {
client
.token_apr()
.create(
apr.apr,
token::UniqueWhereParam::KeyEquals(apr.token_key),
vec![token_apr::apr_set::connect(apr_set::id::equals(apr_set.id))],
)
.exec()
.await?;
}
Ok::<(), anyhow::Error>(())
})
.await?;
Thanks for reminding me of this issue - Took a look at the DMMF schema and it turns out that update_many
and delete_many
take WhereInput
and not WhereUniqueInput
, so using compound keys (which are only available in WhereUniqueInput
is not actually valid. This should get fixed in 0.7.0 since the way types are being generated is changing.
Also @apollo-sturdy I noticed you're manually using UniqueWhereParam
- I'd recommend you don't do that.
token::key::equals(apr.token_key)
should work and will shield you against breaking changes to UniqueWhereParam
.
First of all, according to my investigation results, it can be guessed that it is a bug in the
engine
. I also tried to find the specific problem, but failedspecific error: