2014-05-23 08:23:50 -04:00
|
|
|
define(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update handler for transition database version 2 -> 3
|
|
|
|
*
|
|
|
|
* In database version 3, we introduced new flags to the messages, also
|
|
|
|
* the outbox uses artificial uids
|
|
|
|
*/
|
2014-07-01 13:49:19 -04:00
|
|
|
function update(options, callback) {
|
2014-05-23 08:23:50 -04:00
|
|
|
var emailDbType = 'email_',
|
|
|
|
versionDbType = 'dbVersion',
|
|
|
|
postUpdateDbVersion = 3;
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-07-01 13:49:19 -04:00
|
|
|
return update;
|
2014-05-23 08:23:50 -04:00
|
|
|
});
|