lib/stores/sql/save.js
function save(options) {
    const self = this
    options = options || {}

    if (self.options.polymorph) return this.callParent(options)

    return Promise.all(
      this.map(function(record) {
        // validate all records at once.
        return record.validate()
      })
    )
      .then(function() {
        // if validation succeeded, start the transaction
        return self.store.startTransaction(options, function() {
          return self
            ._runLazyOperation(options)
            .then(function() {
              // inside the transaction create all new records and afterwards save all the others
              return self._create(options)
            })
            .then(function() {
              // will save all existing records with changes...
              return self.callParent(options, save)
            })
        })
      })
      .then(function() {
        return self
      })
  }
function save(options) {
    const self = this
    options = options || {}

    if (self.options.polymorph) return this.callParent(options)

    return Promise.all(
      this.map(function(record) {
        // validate all records at once.
        return record.validate()
      })
    )
      .then(function() {
        // if validation succeeded, start the transaction
        return self.store.startTransaction(options, function() {
          return self
            ._runLazyOperation(options)
            .then(function() {
              // inside the transaction create all new records and afterwards save all the others
              return self._create(options)
            })
            .then(function() {
              // will save all existing records with changes...
              return self.callParent(options, save)
            })
        })
      })
      .then(function() {
        return self
      })
  }
function save ( options ) { const self = this options = options || { } if ( self . options . polymorph ) return this . callParent ( options ) return Promise . all ( this . map ( function ( record ) { // validate all records at once. return record . validate ( ) } ) ) . then ( function ( ) { // if validation succeeded, start the transaction return self . store . startTransaction ( options , function ( ) { return self . _runLazyOperation ( options ) . then ( function ( ) { // inside the transaction create all new records and afterwards save all the others return self . _create ( options ) } ) . then ( function ( ) { // will save all existing records with changes... return self . callParent ( options , save ) } ) } ) } ) . then ( function ( ) { return self } ) }
create multiple records at once
create multiple records at once