diff --git a/js/modules/messages_data_migrator.js b/js/modules/messages_data_migrator.js index a331aac803..24f9d23f0b 100644 --- a/js/modules/messages_data_migrator.js +++ b/js/modules/messages_data_migrator.js @@ -179,6 +179,7 @@ exports.processAll = async ({ } while (unprocessedMessages.length > 0); await settings.markAttachmentMigrationComplete(connection); + await settings.deleteAttachmentMigrationLastProcessedIndex(connection); console.log('Close database connection'); connection.close(); diff --git a/js/modules/settings.js b/js/modules/settings.js index 9cae707352..9786be7fc3 100644 --- a/js/modules/settings.js +++ b/js/modules/settings.js @@ -8,19 +8,22 @@ const IS_MIGRATION_COMPLETE_KEY = 'attachmentMigration_isComplete'; // Public API exports.getAttachmentMigrationLastProcessedIndex = connection => - getItem(connection, LAST_PROCESSED_INDEX_KEY); + exports._getItem(connection, LAST_PROCESSED_INDEX_KEY); exports.setAttachmentMigrationLastProcessedIndex = (connection, value) => - setItem(connection, LAST_PROCESSED_INDEX_KEY, value); + exports._setItem(connection, LAST_PROCESSED_INDEX_KEY, value); + +exports.deleteAttachmentMigrationLastProcessedIndex = connection => + exports._deleteItem(connection, LAST_PROCESSED_INDEX_KEY); exports.isAttachmentMigrationComplete = async connection => - Boolean(await getItem(connection, IS_MIGRATION_COMPLETE_KEY)); + Boolean(await exports._getItem(connection, IS_MIGRATION_COMPLETE_KEY)); exports.markAttachmentMigrationComplete = connection => - setItem(connection, IS_MIGRATION_COMPLETE_KEY, true); + exports._setItem(connection, IS_MIGRATION_COMPLETE_KEY, true); // Private API -const getItem = (connection, key) => { +exports._getItem = (connection, key) => { if (!isObject(connection)) { throw new TypeError('"connection" is required'); } @@ -41,7 +44,7 @@ const getItem = (connection, key) => { }); }; -const setItem = (connection, key, value) => { +exports._setItem = (connection, key, value) => { if (!isObject(connection)) { throw new TypeError('"connection" is required'); } @@ -62,7 +65,7 @@ const setItem = (connection, key, value) => { }); }; -const deleteItem = (connection, key) => { +exports._deleteItem = (connection, key) => { if (!isObject(connection)) { throw new TypeError('"connection" is required'); }