I am using sequelize to perform a bulkCreate on one of my models. It is basically a simple sync-operation and therefore I want to update the rows that already exist. As per, the updateOnDuplicate
is described as:
Fields to update if row key already exists (on duplicate key update)? (only supported by MySQL, MariaDB, SQLite >= 3.24.0 & Postgres >= 9.5). By default, all fields are updated.
However, there is no way to perform the default behavior. sequelize expects an array of strings and won't except e.g. a simple true
for all columns.
So how can i update ALL fields?
Something like this seems to work fine:
updateOnDuplicate: Object.keys(yourDataInstance)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With