When using TypeORM's upsert
(also known as createQueryBuilder().insert().onConflict().execute()
), if a record with the given unique constraint already exists in the database, it will update the existing record with the values provided. Otherwise, it will create a new record with the provided values. In other words, upsert
will attempt to insert a new record, but if a record with the same unique key already exists, it will instead update the existing record with the new values.
Asked: 2023-02-18 11:00:00 +0000
Seen: 13 times
Last updated: Nov 15 '22