Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2143,12 +2143,15 @@ + (BOOL)finaliseMigrationWith:(RLMMigration *)migration oldSchemaVersion:(uint64

MXLogDebug(@"[MXRealmCryptoStore] Make sure MXRealmOlmAccount.cryptoVersion is MXCryptoVersion2");
[migration enumerateObjects:MXRealmOlmAccount.className block:^(RLMObject *oldObject, RLMObject *newObject) {
NSNumber *version;
MXJSONModelSetNumber(version, oldObject[@"cryptoVersion"]);
if (version && version.intValue == 0)
{
MXLogDebug(@"[MXRealmCryptoStore] -> Fix MXRealmOlmAccount.cryptoVersion");
newObject[@"cryptoVersion"] = @(MXCryptoVersion2);
if (oldSchemaVersion > 12) {
// cryptoVersion available
NSNumber *version;
MXJSONModelSetNumber(version, oldObject[@"cryptoVersion"]);
if (version && version.intValue == 0)
{
MXLogDebug(@"[MXRealmCryptoStore] -> Fix MXRealmOlmAccount.cryptoVersion");
newObject[@"cryptoVersion"] = @(MXCryptoVersion2);
}
}
}];
}
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1282.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MXRealmCryptoStore: fix migration from schema < 13 to schema > 16.