When updating message schema pre-SQLCipher, use legacy save

This commit is contained in:
Scott Nonnenberg 2018-08-01 12:38:48 -07:00
parent 3b7ee3e2ce
commit b1c6a5fe19
3 changed files with 22 additions and 12 deletions

View file

@ -230,7 +230,7 @@
upgradeMessageSchema,
maxVersion: MINIMUM_VERSION,
BackboneMessage: Whisper.Message,
saveMessage: window.Signal.Data.saveMessage,
saveMessage: window.Signal.Data.saveLegacyMessage,
}
);
window.log.info(
@ -251,7 +251,7 @@
upgradeMessageSchema,
getMessagesNeedingUpgrade:
window.Signal.Data.getLegacyMessagesNeedingUpgrade,
saveMessage: window.Signal.Data.saveMessage,
saveMessage: window.Signal.Data.saveLegacyMessage,
maxVersion: MINIMUM_VERSION,
});
window.log.info('upgradeMessages: upgrade with index', batchWithIndex);
@ -264,6 +264,16 @@
await upgradeMessages();
const db = await Whisper.Database.open();
await window.Signal.migrateToSQL({
db,
clearStores: Whisper.Database.clearStores,
handleDOMException: Whisper.Database.handleDOMException,
});
// Note: We are not invoking the second set of IndexedDB migrations because it is
// likely that any future migrations will simply extracting things from IndexedDB.
idleDetector = new IdleDetector();
let isMigrationWithIndexComplete = false;
window.log.info(
@ -296,16 +306,6 @@
}
});
const db = await Whisper.Database.open();
await window.Signal.migrateToSQL({
db,
clearStores: Whisper.Database.clearStores,
handleDOMException: Whisper.Database.handleDOMException,
});
// Note: We are not invoking the second set of IndexedDB migrations because it is
// likely that any future migrations will simply extracting things from IndexedDB.
// These make key operations available to IPC handlers created in preload.js
window.Events = {
getDeviceName: () => textsecure.storage.user.getDeviceName(),