The issue is when you have two different object stores in the same indexeddb, primary key values appear to be \"shared\" across all stores.
I had a similar problem however my first insert to the objectstore was a small array with just username and email and the second objectstore was very large with several nested arrays of data.
My insert method below would call back success on the all items however only the second object store would be written to the db correctly.
When I tried reversing the order I was writing to the database (writing the large objectstore items first and the username/email second) both objectstores were written correctly however the the primary keys were shared between the two objects stores. Pilots Primary Key: 1,2,3,4,5 AC Primary Key: 6,7,8...
function insert_GroupRecord(Record, Store){
//update individual sync record
var trans = dbGroup.transaction([Store],"readwrite");
var store = trans.objectStore(Store);
var request = store.put(Record);
request.onsuccess = function(e){
IOS_postMessage({Message:"SyncStatus", status:"Group_Insert "+Store});
};
request.onerror = function(e){
GroupSyncERROR = true;
//IOS_postMessage({Message:"SyncStatus", status:"GroupSyncFail "+Store});
};
request.onupgradeneeded = function(evt){
var objectStore = evt.currentTarget.result.createObjectStore("AC",{ keyPath: "id", autoIncrement: true });
objectStore.createIndex("ident", "ident", { unique: true });
var objectStore2 = evt.currentTarget.result.createObjectStore("Pilots",{ keyPath: "id", autoIncrement: true });
objectStore2.createIndex("chatname", "chatname", { unique: true });
console.log("KFM_Group Upgrade Completed");
};
}