UPSERT many ?
I have a table called
Each day, I receive an array with all of the companies of my client. The thing is: I need to insert a new company in
Here's the syntax from the docs (https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/pg-core/README.md#upsert-insert-with-on-conflict-statement);
But because I have an array - I'd like to do an UPSERT on the whole array, instead of looping through it with a
Do you know if / how I could achieve that ? Much appreciated.
crmCompanies containing companies from my client's CRMs. Each day, I receive an array with all of the companies of my client. The thing is: I need to insert a new company in
crmCompanies if it doesn't exist otherwise, update all its values. Here's the syntax from the docs (https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/pg-core/README.md#upsert-insert-with-on-conflict-statement);
await db.insert(users).values({ id: 1, name: 'Dan' }).onConflictDoUpdate({ target: users.id, set: { name: 'John' } });But because I have an array - I'd like to do an UPSERT on the whole array, instead of looping through it with a
for loop - if that makes sense.Do you know if / how I could achieve that ? Much appreciated.