es2015/migration/DatabaseVersionMigrator.js
function upgradeSchema(nativeDatabase, nativeTransaction, descriptors) {
  let objectStoreNames = Array.from(nativeDatabase.objectStoreNames)
  let newObjectStoreNames = descriptors.map((objectStore) => {
    return objectStore.name
  })
  objectStoreNames.forEach((objectStoreName) => {
    if (newObjectStoreNames.indexOf(objectStoreName) === -1) {
      nativeDatabase.deleteObjectStore(objectStoreName)
    }
  })

  descriptors.forEach((objectStoreDescriptor) => {
    let objectStoreName = objectStoreDescriptor.name
    let nativeObjectStore = objectStoreNames.indexOf(objectStoreName) > -1 ?
        nativeTransaction.objectStore(objectStoreName) : null

    let objectStoreMigrator = new ObjectStoreMigrator(nativeDatabase,
        nativeObjectStore, objectStoreDescriptor)
    objectStoreMigrator.executeMigration()
  })
}
function upgradeSchema(nativeDatabase, nativeTransaction, descriptors) {
  let objectStoreNames = Array.from(nativeDatabase.objectStoreNames)
  let newObjectStoreNames = descriptors.map((objectStore) => {
    return objectStore.name
  })
  objectStoreNames.forEach((objectStoreName) => {
    if (newObjectStoreNames.indexOf(objectStoreName) === -1) {
      nativeDatabase.deleteObjectStore(objectStoreName)
    }
  })

  descriptors.forEach((objectStoreDescriptor) => {
    let objectStoreName = objectStoreDescriptor.name
    let nativeObjectStore = objectStoreNames.indexOf(objectStoreName) > -1 ?
        nativeTransaction.objectStore(objectStoreName) : null

    let objectStoreMigrator = new ObjectStoreMigrator(nativeDatabase,
        nativeObjectStore, objectStoreDescriptor)
    objectStoreMigrator.executeMigration()
  })
}
function upgradeSchema ( nativeDatabase , nativeTransaction , descriptors ) { let objectStoreNames = Array . from ( nativeDatabase . objectStoreNames ) let newObjectStoreNames = descriptors . map ( ( objectStore ) => { return objectStore . name } ) objectStoreNames . forEach ( ( objectStoreName ) => { if ( newObjectStoreNames . indexOf ( objectStoreName ) === - 1 ) { nativeDatabase . deleteObjectStore ( objectStoreName ) } } ) descriptors . forEach ( ( objectStoreDescriptor ) => { let objectStoreName = objectStoreDescriptor . name let nativeObjectStore = objectStoreNames . indexOf ( objectStoreName ) > - 1 ? nativeTransaction . objectStore ( objectStoreName ) : null let objectStoreMigrator = new ObjectStoreMigrator ( nativeDatabase , nativeObjectStore , objectStoreDescriptor ) objectStoreMigrator . executeMigration ( ) } ) }
Updates the schema of the provided Indexed DB database to the schema
specified by the provided schema descriptors.

@param {IDBDatabase} nativeDatabase The native Indexed DB database being
migrated.
@param {IDBTransaction} nativeTransaction The native {@code versionchange}
transaction.
@param {((DatabaseSchema|UpgradedDatabaseSchema))[]} descriptors Schema
descriptor of the version to which the database is to be upgraded.
Updates the schema of the provided Indexed DB database to the schema specified by the provided schema descriptors .