Answers for "adonisjs delete rollback transaction"

0

adonisjs delete rollback transaction

'use strict';

class SafeDelete {
  register(Model, customOptions = {}) {
    const defaultOptions = {};
    const options = Object.assign(defaultOptions, customOptions);
    const safeDelete = async function(trx) {
      return trx
        .from(Model.table)
        .where(Model.primaryKey, this[Model.primaryKey])
        .del();
    };

    Model.prototype.safeDelete = safeDelete;
  }
}

module.exports = SafeDelete;
Posted by: Guest on November-14-2020

Code answers related to "adonisjs delete rollback transaction"

Code answers related to "Javascript"

Browse Popular Code Answers by Language