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

22 lines
691 B
JavaScript
Raw Normal View History

2014-10-02 16:05:44 -04:00
'use strict';
2014-03-11 11:06:19 -04:00
2014-10-02 16:05:44 -04:00
/**
* 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.
*/
2014-12-11 07:57:40 -05:00
function updateV1(options) {
2014-10-02 16:05:44 -04:00
var emailDbType = 'email_',
versionDbType = 'dbVersion',
postUpdateDbVersion = 1;
2014-03-11 11:06:19 -04:00
2014-10-02 16:05:44 -04:00
// remove the emails
2014-12-11 07:57:40 -05:00
return options.userStorage.removeList(emailDbType).then(function() {
2014-10-02 16:05:44 -04:00
// update the database version to postUpdateDbVersion
2014-12-11 07:57:40 -05:00
return options.appConfigStorage.storeList([postUpdateDbVersion], versionDbType);
2014-10-02 16:05:44 -04:00
});
}
2014-03-11 11:06:19 -04:00
2014-10-08 06:34:34 -04:00
module.exports = updateV1;