I can't figure out how the soft deleting works with SequelizeJS and I cannot find any documentation online.
I've already setup at a deletedAt
column as
deletedAt: {
type: Sequelize.DATE
}
but I don't know how to now setup the system so that MyModel.destroy(query)
soft deletes it instead. Currently, it plainly removes the entry completely.
http://docs.sequelizejs.com/en/latest/api/sequelize/#definemodelname-attributes-options-model
Set options.timestamps
and options.paranoid
to true - then sequelize will add the deletedAt
column for you, and set it instead of deleting the row
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With