Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The request.onupgradeneeded part, db.version === dbVersion #4

Open
Humphrey-Huang opened this issue Jul 4, 2013 · 2 comments
Open

Comments

@Humphrey-Huang
Copy link

Seems when this function is invoked, the db.version has been changed.
So, I try to change codes as followed, please check:

    request.onupgradeneeded = function(e) {
        todoDB.indexedDB.db = e.target.result;
        var db = todoDB.indexedDB.db;
        console.log ("Going to upgrade our DB from version: "+ e.oldVersion + " to " + e.newVersion);
        if(db.objectStoreNames.contains("todo")) {
            db.deleteObjectStore("todo");
        }

        var store = db.createObjectStore("todo", {keyPath: "timeStamp"});
        console.log("-- onupgradeneeded store:"+ JSON.stringify(store));
    };
@greenido
Copy link
Owner

greenido commented Jul 4, 2013

Could you please have a look at the changes that I've made to the code?
I guess it was the objectStoreNames that coz it.
Thanks!

@greenido1
Copy link

closing... ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants