postgresql - How to use prisma updateManyupsert in order to update multiple data with one database query? - Stack Overflow

时间: 2025-01-06 admin 业界

I am using postgresql data with prisma as ORM, I have a table name product and I wanted to use upsert to store data inside it. It will not create data as I am filtering it before using this.

Let's say below is my api payload that I want to upsert.

[     
 {         
   "productId": "1",         
   "productName": "TEST1"     
 },     
 {         
   "productId": "2",         
   "productName": "TEST2"     
 } 
]

let's say I have already data inside it like

id productId productName
1 1111 Cell 2
2 2222 Cell 4
最新文章