From e2f1339ab97fa4d6e475dcc298390adac8549eb4 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Mon, 26 Mar 2018 15:17:35 -0400 Subject: [PATCH] Explicitly run post-attachment migrations --- js/background.js | 11 ++++++++++- .../migrations_1_database_without_attachment_data.js | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/js/background.js b/js/background.js index 7fc323e8e..e21c45e28 100644 --- a/js/background.js +++ b/js/background.js @@ -17,7 +17,10 @@ const { IdleDetector, MessageDataMigrator } = Signal.Workflow; const { Errors, Message } = window.Signal.Types; const { upgradeMessageSchema } = window.Signal.Migrations; - const { Migrations0DatabaseWithAttachmentData } = window.Signal.Database; + const { + Migrations0DatabaseWithAttachmentData, + Migrations1DatabaseWithoutAttachmentData, + } = window.Signal.Database; const { Views } = window.Signal; // Implicitly used in `indexeddb-backbonejs-adapter`: @@ -85,6 +88,12 @@ await Migrations0DatabaseWithAttachmentData.run({ Backbone }); console.log('Migrate database without attachments'); + await Migrations1DatabaseWithoutAttachmentData.run({ + Backbone, + Database: Whisper.Database, + }); + + console.log('Storage fetch'); storage.fetch(); const NUM_MESSAGE_UPGRADES_PER_IDLE = 2; diff --git a/js/modules/migrations/migrations_1_database_without_attachment_data.js b/js/modules/migrations/migrations_1_database_without_attachment_data.js index 5cb5446c8..04bacb870 100644 --- a/js/modules/migrations/migrations_1_database_without_attachment_data.js +++ b/js/modules/migrations/migrations_1_database_without_attachment_data.js @@ -1,3 +1,6 @@ +const { runMigrations } = require('./run_migrations'); + + exports.migrations = [ { version: 18, @@ -7,3 +10,6 @@ exports.migrations = [ }, }, ]; + +exports.run = ({ Backbone, Database } = {}) => + runMigrations({ Backbone, database: Database });