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
2014-12-18 15:25:18 +01:00

22 lines
691 B
JavaScript

'use strict';
/**
* Update handler for transition database version 0 -> 1
*
* 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) {
var emailDbType = 'email_',
versionDbType = 'dbVersion',
postUpdateDbVersion = 1;
// remove the emails
return options.userStorage.removeList(emailDbType).then(function() {
// update the database version to postUpdateDbVersion
return options.appConfigStorage.storeList([postUpdateDbVersion], versionDbType);
});
}
module.exports = updateV1;