Fix migrations
Migrations should always call next() exactly once. // FREEBIE
This commit is contained in:
parent
87ddcef333
commit
bf632bfa54
1 changed files with 12 additions and 0 deletions
|
@ -38,6 +38,7 @@
|
||||||
{
|
{
|
||||||
version: "2.0",
|
version: "2.0",
|
||||||
migrate: function(transaction, next) {
|
migrate: function(transaction, next) {
|
||||||
|
console.log('migration 2.0');
|
||||||
var conversations = transaction.objectStore("conversations");
|
var conversations = transaction.objectStore("conversations");
|
||||||
conversations.createIndex("search", "tokens", { unique: false, multiEntry: true });
|
conversations.createIndex("search", "tokens", { unique: false, multiEntry: true });
|
||||||
|
|
||||||
|
@ -48,11 +49,13 @@
|
||||||
model.save();
|
model.save();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
version: "3.0",
|
version: "3.0",
|
||||||
migrate: function(transaction, next) {
|
migrate: function(transaction, next) {
|
||||||
|
console.log('migration 3.0');
|
||||||
var conversations = transaction.objectStore("items");
|
var conversations = transaction.objectStore("items");
|
||||||
|
|
||||||
var all = new Whisper.ConversationCollection();
|
var all = new Whisper.ConversationCollection();
|
||||||
|
@ -67,11 +70,13 @@
|
||||||
storage.remove('unreadCount');
|
storage.remove('unreadCount');
|
||||||
storage.put('unreadCount', unreadCount);
|
storage.put('unreadCount', unreadCount);
|
||||||
});
|
});
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
version: "4.0",
|
version: "4.0",
|
||||||
migrate: function(transaction, next) {
|
migrate: function(transaction, next) {
|
||||||
|
console.log('migration 4.0');
|
||||||
var all = new Whisper.ConversationCollection();
|
var all = new Whisper.ConversationCollection();
|
||||||
all.fetch().then(function() {
|
all.fetch().then(function() {
|
||||||
all.each(function(c) {
|
all.each(function(c) {
|
||||||
|
@ -79,19 +84,23 @@
|
||||||
c.save();
|
c.save();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
version: "5.0",
|
version: "5.0",
|
||||||
migrate: function(transaction, next) {
|
migrate: function(transaction, next) {
|
||||||
|
console.log('migration 5.0');
|
||||||
if (storage.get("chromiumRegistrationDone") === "") {
|
if (storage.get("chromiumRegistrationDone") === "") {
|
||||||
storage.put("chromiumRegistrationDoneEver", "");
|
storage.put("chromiumRegistrationDoneEver", "");
|
||||||
}
|
}
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
version: "6.0",
|
version: "6.0",
|
||||||
migrate: function(transaction, next) {
|
migrate: function(transaction, next) {
|
||||||
|
console.log('migration 6.0');
|
||||||
storage.onready(function() {
|
storage.onready(function() {
|
||||||
if (storage.get("chromiumRegistrationDone") === "") {
|
if (storage.get("chromiumRegistrationDone") === "") {
|
||||||
storage.put("chromiumRegistrationDoneEver", "");
|
storage.put("chromiumRegistrationDoneEver", "");
|
||||||
|
@ -99,12 +108,15 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
storage.fetch();
|
storage.fetch();
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
version: "7.0",
|
version: "7.0",
|
||||||
migrate: function(transaction, next) {
|
migrate: function(transaction, next) {
|
||||||
|
console.log('migration 7.0');
|
||||||
transaction.db.createObjectStore("debug");
|
transaction.db.createObjectStore("debug");
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue