From 01593363ebf74ca840460c3af7d5465ab456f27d Mon Sep 17 00:00:00 2001 From: lilia Date: Fri, 4 Dec 2015 17:24:37 -0800 Subject: [PATCH] Add migration to update search tokens Previous commit changed the token schema slightly so now we need to run a migration to update existing conversations. // FREEBIE --- js/database.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/database.js b/js/database.js index d6a52aa58..6298a6282 100644 --- a/js/database.js +++ b/js/database.js @@ -68,6 +68,18 @@ storage.put('unreadCount', unreadCount); }); } + }, + { + version: "4.0", + migrate: function(transaction, next) { + var all = new Whisper.ConversationCollection(); + all.fetch().then(function() { + all.each(function(c) { + c.updateTokens(); + c.save(); + }); + }); + } } ]; }());