* Increment the value of one or more columns. This is done in the database, which means it does not use the values currently stored on the Instance. The increment is done using a
* Increment the value of one or more columns. This is done in the database, which means it does not use the values currently stored on the Instance. The increment is done using a
* Restore multiple instances if `paranoid` is enabled.
*
* @param {Object} [options.where] Filter the restore
* @param {Boolean} [options.hooks=true] Run before / after bulk restore hooks?
* @param {Boolean} [options.individualHooks=false] If set to true, restore will find all records within the where parameter and will execute before / after bulkRestore hooks on each row
* @param {Number} [options.limit] How many rows to undelete
*
* @return {Promise<undefined>}
*/
Model.prototype.restore=function(options){
if(!this._timestampAttributes.deletedAt)thrownewError("Model is not paranoid");
options=Utils._.extend({
hooks:true,
individualHooks:false
},options||{});
options.type=QueryTypes.BULKUNDELETE;
varself=this
,instances;
mapFieldNames.call(this,options,this);
returnPromise.try(function(){
// Run before hook
if(options.hooks){
returnself.runHooks('beforeBulkRestore',options);
}
}).then(function(){
// Get daos and run beforeDestroy hook on each record individually
* Update multiple instances that match the where options. The promise returns an array with one or two elements. The first element is always the number
* Update multiple instances that match the where options. The promise returns an array with one or two elements. The first element is always the number
* of affected rows, while the second element is the actual affected rows (only supported in postgres with `options.returning` true.)
* of affected rows, while the second element is the actual affected rows (only supported in postgres with `options.returning` true.)