Updating multiple rows causes type error
I'm following the guide posted here https://orm.drizzle.team/learn/guides/update-many-with-different-value regarding updating multiple rows at once.
My data is similar, but not the same:
The raw output is:
Unfortunately, this causes a type error when being submitted:
I assume this is because the sql is being converted to something like this:
therefore it's being recognized as a string whenever it's submitted to the database. But I could be wrong.
Is it possible to cast this value somehow or otherwise inform Drizzle that it's supposed to be an integer and not a string?
Drizzle ORM - Update many with different values for each row
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
7 Replies
What does the full update query look like?
In Typescript (raw SQL would be nice too
How do I get the raw SQL?
Sorry, I meant something like the "raw output" you provided above, but for the full query (or something close to the full query)
This is the code
It's the same as what is in the linked guide
working on the raw, one min
Try casting the whole case statement to integer, like so:
It worked!! You are a legend thank you so much!
You're welcome!