Skip to content

Instantly share code, notes, and snippets.

@cfjedimaster
Created April 25, 2012 21:52
Show Gist options
  • Save cfjedimaster/2493808 to your computer and use it in GitHub Desktop.
Save cfjedimaster/2493808 to your computer and use it in GitHub Desktop.
var openRequest = indexedDB.open("notes",3);
//handle setup
openRequest.onupgradeneeded = function(e) {
console.log("running onupgradeneeded");
var thisDb = e.target.result;
//Create Note
if(!thisDb.objectStoreNames.contains("note")) {
console.log("I need to make the note objectstore");
var objectStore = thisDb.createObjectStore("note", { keyPath: "id" });
objectStore.createIndex("title", "title", { unique: false });
}
//Create Booger
if(!thisDb.objectStoreNames.contains("booger")) {
console.log("I need to make the booger objectstore");
var objectStore = thisDb.createObjectStore("booger", { keyPath: "id" });
objectStore.createIndex("title", "title", { unique: false });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment