es2015/migration/DatabaseMigrator.js
function migrateDatabaseVersion(nativeDatabase, nativeTransaction,
    descriptor) {
  let fetchPromise
  if (descriptor.fetchBefore && descriptor.fetchBefore.length) {
    let fetcher = new RecordFetcher()
    let objectStores = normalizeFetchBeforeObjectStores(descriptor.fetchBefore)
    fetchPromise = fetcher.fetchRecords(nativeTransaction, objectStores)
  } else {
    fetchPromise = PromiseSync.resolve({})
  }
  
  return fetchPromise.then((recordsMap) => {
    let versionMigrator = new DatabaseVersionMigrator(
      nativeDatabase,
      nativeTransaction,
      descriptor.objectStores
    )
    
    return versionMigrator.executeMigration(
      descriptor.after || (() => {}),
      recordsMap
    )
  })
}
function migrateDatabaseVersion(nativeDatabase, nativeTransaction,
    descriptor) {
  let fetchPromise
  if (descriptor.fetchBefore && descriptor.fetchBefore.length) {
    let fetcher = new RecordFetcher()
    let objectStores = normalizeFetchBeforeObjectStores(descriptor.fetchBefore)
    fetchPromise = fetcher.fetchRecords(nativeTransaction, objectStores)
  } else {
    fetchPromise = PromiseSync.resolve({})
  }
  
  return fetchPromise.then((recordsMap) => {
    let versionMigrator = new DatabaseVersionMigrator(
      nativeDatabase,
      nativeTransaction,
      descriptor.objectStores
    )
    
    return versionMigrator.executeMigration(
      descriptor.after || (() => {}),
      recordsMap
    )
  })
}
Performs a single-version database migration to the schema described by the
provided database schema descriptor.

@param {IDBDatabase} nativeDatabase The native Indexed DB database being
migrated to a higher version.
@param {IDBTransaction} nativeTransaction The native Indexed DB
{@code versionchange} transaction to use to manipulate the data.
@param {(DatabaseSchema|UpgradedDatabaseSchema)} descriptor Schema
descriptor of the version to which the database is to be upgraded.
@return {PromiseSync<undefined>} A promise that resolves once the database
has been upgraded to the schema described by the provided schema
descriptor.