Search code examples
node.jspostgresqlsequelize.jsbulkinsertbulkupdate

Sequelize bulkCreate updateOnDuplicate for postgresQL?


I know there is no support for updateOnDuplicate for postgresQL by Sequelize sequelize doc, so is there a work around for this?

Can it be implemented via "SQL command".


Solution

  • There is some work around. See upsert function. When used in Postgresql it creates custom function in database. Unfortunately there is no bulkUpsert, so you either use it in some for-loop or execute raw SQL as suggested here.