Initialize schema as first step in upgradeSchema

This commit is contained in:
Daniel Gasienica 2018-03-14 15:46:28 -04:00
parent 5d927b73e6
commit a5edbf8328

View file

@ -146,6 +146,9 @@ exports._mapAttachments = upgradeAttachment => async message =>
} }
); );
const toVersion0 = async message =>
exports.initializeSchemaVersion(message);
const toVersion1 = exports._withSchemaVersion( const toVersion1 = exports._withSchemaVersion(
1, 1,
exports._mapAttachments(Attachment.autoOrientJPEG) exports._mapAttachments(Attachment.autoOrientJPEG)
@ -157,4 +160,4 @@ const toVersion2 = exports._withSchemaVersion(
// UpgradeStep // UpgradeStep
exports.upgradeSchema = async message => exports.upgradeSchema = async message =>
toVersion2(await toVersion1(message)); toVersion2(await toVersion1(await toVersion0(message)));