How to undo soft delete in Sequelize.js

You can do this by using paranoid: false :

Model.update( { deletedAt: null }, { where: {deletedAt: {ne: null} }, paranoid: false  });

options.paranoid

If true, only non-deleted records will be updated. If false, both deleted and non-deleted records will be updated. Only applies if options.paranoid is true for the model.

For more detail : DO READ

I know the question is very old and at that time there might not be the solution


Get your object with {paranoid: false} option, ie. var model = Model.findOne({ where: { something: 1 }, paranoid: false }) and then restore it model.restore() http://docs.sequelizejs.com/en/latest/api/instance/#restoreoptions-promiseundefined


You can use instance.setDataValue('deletedAt', null):

var Bluebird  = require('bluebird');
var models    = require('./models');

models.sequelize.sync({ force: true })
.then(function () {
  return models.User.create({ name: 'user' })
})
.then(function (user) {
  return user.destroy()
})
.then(function () {
  return models.sequelize.models.User.findAll({ paranoid: false });
})
.then(function (users) {
  var user = users[0];
  user.setDataValue('deletedAt', null);
  return user.save({ paranoid: false });
}).then(function () {
  return models.sequelize.models.User.findAll();
}).then(function (users) {
  console.log(users[0]);
});

Please note that this snippet uses Sequelize@v2