update multiple rows is not working. PostgresError: column excluded.name does not exist
I'm trying to insert multiple rows and update onconflict for those rows that have conflict.
this is my schema for order_phases
I wonder if I'm using excluded wrongly?
4 Replies
I have a requirement whereby i will be inserting/updating a list of values at once and each item will be a row in the table, I wonder how am I suppose to delete multiple rows for those values that are no longer in the list when send to
updateRestaurantSettings
function ? Is it by checking the orderPhaseValues in updateRestaurantSettings
and the order_phases
table, then if the value exist in the table but doesnt exist in orderPhaseValues, that value needs to be deleted? I wonder if there's a more efficient way to perform this deletion.
i have decided to use this instead
you can always enable statement logging in drizzle to see what sql is actually being generated and sent to the driver
https://orm.drizzle.team/learn/guides/upsert
i spend way too much time on this as well, but they must have add docs to this recently
Drizzle ORM - Upsert Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Thanks for the help!