MCPcopy
hub / github.com/sequelize/sequelize / bulkUpdate

Method bulkUpdate

lib/dialects/abstract/query-interface.js:897–908  ·  view source on GitHub ↗

* Update multiple records of a table * * @example * queryInterface.bulkUpdate('roles', { * label: 'admin', * }, { * userType: 3, * }, * ); * * @param {string} tableName Table name to update * @param {object} values Values to be inserted, mapped

(tableName, values, identifier, options, attributes)

Source from the content-addressed store, hash-verified

895 * @returns {Promise}
896 */
897 async bulkUpdate(tableName, values, identifier, options, attributes) {
898 options = Utils.cloneDeep(options);
899 if (typeof identifier === 'object') identifier = Utils.cloneDeep(identifier);
900
901 const sql = this.queryGenerator.updateQuery(tableName, values, identifier, options, attributes);
902 const table = _.isObject(tableName) ? tableName : { tableName };
903 const model = _.find(this.sequelize.modelManager.models, { tableName: table.tableName });
904
905 options.type = QueryTypes.BULKUPDATE;
906 options.model = model;
907 return await this.sequelize.query(sql, options);
908 }
909
910 async delete(instance, tableName, identifier, options) {
911 const cascades = [];

Callers 4

testFunction · 0.80
destroyMethod · 0.80
restoreMethod · 0.80
updateMethod · 0.80

Calls 2

updateQueryMethod · 0.45
queryMethod · 0.45

Tested by 1

testFunction · 0.64