Correct way of handling upserts in MySql
Hey folks! I am using MySql and cannot use
onConflictDoUpdate
. In leu of that I am wondering if this is a correct way of doing upserts
In my use case this record is going to be created once and then updated several times.3 Replies
Have just started using drizzle and my first take was this:
Oh cool, I seemed to have missed
onDuplicateKeyUpdate
. Ill try that and see. Thanks!
Thank you so much this works perfectly!Awesome:) It is a little bit oversimplified, but I guess as long as you do simple data update operations and validate your input schemas with something like zod, it should be fairly safe.