axemclion / jquery-indexeddb

An IndexedDB Plugin for Jquery.
Other
195 stars 71 forks source link

Multi-schema bug? #6

Closed magnusmanske closed 12 years ago

magnusmanske commented 12 years ago

The current version does not generate an object store for me (Chrome 21, Mac) if there is only one entry in "schema", but it works if there are two, even if the second one is empty.

This works:

        $.indexedDB(me.dbname, {
            "schema": {
                "1": function(versionTransaction){
                    console.log("Running update 1");
                    var objectStore2 = versionTransaction.createObjectStore("b", {
                        "keyPath": "id",
                        "autoIncrement": true
                    });
                },
                "2": function(versionTransaction){
                    console.log("Running update 2");
                }
            }
        }) ;

This does not:

        $.indexedDB(me.dbname, {
            "schema": {
                "1": function(versionTransaction){
                    console.log("Running update 1");
                    var objectStore2 = versionTransaction.createObjectStore("b", {
                        "keyPath": "id",
                        "autoIncrement": true
                    });
                }
            }
        }) ;
axemclion commented 12 years ago

Fixed the bug in SHA: 42f76389bc911f75534145d2aef3c92774c11b98

Tested on Chrome Canary, Chrome and Firefox.

Please confirm and reopen issue if you think this is still an issue.

magnusmanske commented 12 years ago

Fix confirmed, thanks.