Open mordechaim opened 1 day ago
Does your code has select
, get
, pluck
, rows
, something like that?
Because the error suggests that the bug is related to RETURNING
, i.e what you're selecting from the upsert.
Maybe this is related to computed columns, give me a hint.
This is the query verbatim
await db.facilityRole.findBy({ facilityId, roleId }).upsert({
data: {
billRate,
payRate
},
create: {
roleId,
facilityId,
billRate,
payRate
}
})
No computed fields on this table, just a simple join table with 4 columns roleId
, facilityId
, billRate
and payRate
plus id
and timestamps.
The role and facility columns have foreign keys, and unique index on them.
Looks like it's not meant to have a returning
at all and that's a direction to look for the bug.
I'll fix on the next occasion, and for now downgrade the version temporary.
One more detail, it only happens if the record is not found and a new is created
In the latest OrchidORM 1.38.2
upsert
is broken for me. Trying to upsert in my code throws this error:I tried to reproduce it on a clean project but it works in isolation so I'm not sure what exactly triggers it. But I do see a recent commit that touched
upsert
https://github.com/romeerez/orchid-orm/commit/2b3ae9b0c7c4334bbb850b78c94a8e82690e6de7.My code works perfectly in Orchid 1.38.1