function adjustToExistingIndexNames()

in public/dexie.js [4854:4888]


    function adjustToExistingIndexNames(schema, idbtrans) {
      /// <summary>
      /// Issue #30 Problem with existing db - adjust to existing index names when migrating from non-dexie db
      /// </summary>
      /// <param name="schema" type="Object">Map between name and TableSchema</param>
      /// <param name="idbtrans" type="IDBTransaction"></param>
      var storeNames = idbtrans.db.objectStoreNames;
      for (var i = 0; i < storeNames.length; ++i) {
        var storeName = storeNames[i];
        var store = idbtrans.objectStore(storeName);
        hasGetAll = "getAll" in store;
        for (var j = 0; j < store.indexNames.length; ++j) {
          var indexName = store.indexNames[j];
          var keyPath = store.index(indexName).keyPath;
          var dexieName =
            typeof keyPath === "string"
              ? keyPath
              : "[" + slice(keyPath).join("+") + "]";
          if (schema[storeName]) {
            var indexSpec = schema[storeName].idxByName[dexieName];
            if (indexSpec) indexSpec.name = indexName;
          }
        }
      }
      // Bug with getAll() on Safari ver<604 on Workers only, see discussion following PR #579
      if (
        /Safari/.test(navigator.userAgent) &&
        !/(Chrome\/|Edge\/)/.test(navigator.userAgent) &&
        _global.WorkerGlobalScope &&
        _global instanceof _global.WorkerGlobalScope &&
        [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604
      ) {
        hasGetAll = false;
      }
    }