How to include the deleted elements when querying a "paranoid" table on sequelize.js?
javascript, sequelize.js
Solution
Just run your query like this:
User.find({
where: {email: req.body.user.email},
paranoid: false
})
Problem
I want that previously existing users on my application, that have been deleted using the paranoid mode (so now its field `deletedAt` is NOT `null`), to be able to register again using the same email. So when the API notices a user creation with a previously used email it sets to `null` the `deletedAt` field of the previously existing register instead of creating a new user. Usually for looking for an user I will do, `User.find( { where: { email: req.body.user.email } })` But upon inspection of the SQL query created, it includes `Users.deletedAt IS NULL` Is there any special way of finding when dealing with paranoid models?