Explicitly run post-attachment migrations

This commit is contained in:
Daniel Gasienica 2018-03-26 15:17:35 -04:00
parent d7c8d33edb
commit e2f1339ab9
2 changed files with 16 additions and 1 deletions

View file

@ -17,7 +17,10 @@
const { IdleDetector, MessageDataMigrator } = Signal.Workflow; const { IdleDetector, MessageDataMigrator } = Signal.Workflow;
const { Errors, Message } = window.Signal.Types; const { Errors, Message } = window.Signal.Types;
const { upgradeMessageSchema } = window.Signal.Migrations; const { upgradeMessageSchema } = window.Signal.Migrations;
const { Migrations0DatabaseWithAttachmentData } = window.Signal.Database; const {
Migrations0DatabaseWithAttachmentData,
Migrations1DatabaseWithoutAttachmentData,
} = window.Signal.Database;
const { Views } = window.Signal; const { Views } = window.Signal;
// Implicitly used in `indexeddb-backbonejs-adapter`: // Implicitly used in `indexeddb-backbonejs-adapter`:
@ -85,6 +88,12 @@
await Migrations0DatabaseWithAttachmentData.run({ Backbone }); await Migrations0DatabaseWithAttachmentData.run({ Backbone });
console.log('Migrate database without attachments'); console.log('Migrate database without attachments');
await Migrations1DatabaseWithoutAttachmentData.run({
Backbone,
Database: Whisper.Database,
});
console.log('Storage fetch');
storage.fetch(); storage.fetch();
const NUM_MESSAGE_UPGRADES_PER_IDLE = 2; const NUM_MESSAGE_UPGRADES_PER_IDLE = 2;

View file

@ -1,3 +1,6 @@
const { runMigrations } = require('./run_migrations');
exports.migrations = [ exports.migrations = [
{ {
version: 18, version: 18,
@ -7,3 +10,6 @@ exports.migrations = [
}, },
}, },
]; ];
exports.run = ({ Backbone, Database } = {}) =>
runMigrations({ Backbone, database: Database });