启用软删除后如何通过书架进行硬删除

How to hard delete by bookshelf when soft delete enable

假设,我想临时删除,这样我就可以使用书架软删除,但是在那种情况下,当我需要永久删除table的行时。那么,当为模型启用软删除时,我该如何做到这一点。

`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;

    }
})

如果您想永久删除某些内容,即使模型启用了软删除,请将 hardDelete 设置为 true,例如

new contactUs({ id }).destroy({ hardDelete: true })