mail/src/js/util/update/update-v2.js

26 lines
749 B
JavaScript
Raw Normal View History

2014-10-02 16:05:44 -04:00
'use strict';
2014-10-02 16:05:44 -04:00
/**
* Update handler for transition database version 1 -> 2
*
* In database version 2, the stored email objects have to be purged, because the
* new data model stores information about the email structure in the property 'bodyParts'.
*/
function updateV2(options, callback) {
var emailDbType = 'email_',
versionDbType = 'dbVersion',
postUpdateDbVersion = 2;
2014-10-02 16:05:44 -04:00
// remove the emails
options.userStorage.removeList(emailDbType, function(err) {
if (err) {
callback(err);
return;
}
2014-10-02 16:05:44 -04:00
// update the database version to postUpdateDbVersion
options.appConfigStorage.storeList([postUpdateDbVersion], versionDbType, callback);
});
}
2014-10-02 16:05:44 -04:00
exports = updateV2;