當你需要刪除一筆資料,但不要實際刪除資料,只想多一個欄位叫 deletedAt
,並把刪除時間更新上去,sequelize
有提供這個功能,真的蠻實用的。
don’t delete database entries but set the newly added attribute deletedAt
to the current date (when deletion was done). paranoid will only work if
timestamps are enabled
1 | var ContactUs = sequelize.define('ContactUs', { |
資料來源
http://docs.sequelizejs.com/en/latest/docs/models-definition/