【发布时间】:2020-08-24 22:48:45
【问题描述】:
假设,我想暂时删除,以便可以使用书架软删除,但在这种情况下,当我需要永久删除表格的行时。那么,当为模型启用软删除时,我该怎么做呢?
`use strict`
const Bookshelf = require('../bookshelf');
module.exports = Bookshelf.model('contactUs', {
tableName: `contact_us`,
hasTimestamps: ['created_at', 'updated_at'],
softDelete: true,
hidden: ['deleted_at'],
parse: function (response) {
if (response.allowUseOfMyContactInformation != null) {
response.allowUseOfMyContactInformation = !!+response.allowUseOfMyContactInformation
}
return response;
}
})
【问题讨论】:
标签: mysql sql node.js knex.js bookshelf.js