1
0
mirror of https://github.com/moparisthebest/mail synced 2024-08-13 16:43:47 -04:00
mail/src/js/util/update/update-v1.js

29 lines
878 B
JavaScript
Raw Normal View History

2014-03-11 11:06:19 -04:00
define(function() {
'use strict';
/**
2014-03-11 11:34:26 -04:00
* Update handler for transition database version 0 -> 1
2014-03-11 11:06:19 -04:00
*
* In database version 1, the stored email objects have to be purged, otherwise
* every non-prefixed mail in the IMAP folders would be nuked due to the implementation
* of the delta sync.
*/
function updateV1(options, callback) {
var emailDbType = 'email_',
versionDbType = 'dbVersion',
postUpdateDbVersion = 1;
// remove the emails
options.userStorage.removeList(emailDbType, function(err) {
if (err) {
callback(err);
return;
}
// update the database version to postUpdateDbVersion
options.appConfigStorage.storeList([postUpdateDbVersion], versionDbType, callback);
});
}
return updateV1;
});