MCPcopy
hub / github.com/sequelize/sequelize / bulkDelete

Method bulkDelete

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

* Delete multiple records from a table * * @param {string} tableName table name from where to delete records * @param {object} where where conditions to find records to delete * @param {object} [options] options * @param {boolean} [options.trunc

(tableName, where, options, model)

Source from the content-addressed store, hash-verified

954 * @returns {Promise}
955 */
956 async bulkDelete(tableName, where, options, model) {
957 options = Utils.cloneDeep(options);
958 options = _.defaults(options, { limit: null });
959
960 if (options.truncate === true) {
961 return this.sequelize.query(
962 this.queryGenerator.truncateTableQuery(tableName, options),
963 options
964 );
965 }
966
967 if (typeof identifier === 'object') where = Utils.cloneDeep(where);
968
969 return await this.sequelize.query(
970 this.queryGenerator.deleteQuery(tableName, where, options, model),
971 options
972 );
973 }
974
975 async select(model, tableName, optionsArg) {
976 const options = { ...optionsArg, type: QueryTypes.SELECT, model };

Callers 2

testFunction · 0.80
destroyMethod · 0.80

Calls 3

queryMethod · 0.45
truncateTableQueryMethod · 0.45
deleteQueryMethod · 0.45

Tested by 1

testFunction · 0.64