mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
Objective-C
47 lines
1.1 KiB
Objective-C
//
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "OWS109OutgoingMessageState.h"
|
|
#import <SignalServiceKit/OWSPrimaryStorage.h>
|
|
#import <SignalServiceKit/TSOutgoingMessage.h>
|
|
#import <YapDatabase/YapDatabaseTransaction.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
// Increment a similar constant for every future DBMigration
|
|
static NSString *const OWS109OutgoingMessageStateMigrationId = @"109";
|
|
|
|
@implementation OWS109OutgoingMessageState
|
|
|
|
+ (NSString *)migrationId
|
|
{
|
|
return OWS109OutgoingMessageStateMigrationId;
|
|
}
|
|
|
|
// Override parent migration
|
|
- (void)runUpWithCompletion:(OWSDatabaseMigrationCompletion)completion
|
|
{
|
|
OWSAssertDebug(completion);
|
|
|
|
|
|
OWSDatabaseConnection *dbConnection = (OWSDatabaseConnection *)self.primaryStorage.newDatabaseConnection;
|
|
|
|
[self resaveDBCollection:TSOutgoingMessage.collection
|
|
filter:^(id entity) {
|
|
return [entity isKindOfClass:[TSOutgoingMessage class]];
|
|
}
|
|
dbConnection:dbConnection
|
|
completion:^{
|
|
OWSLogInfo(@"Completed migration %@", self.uniqueId);
|
|
|
|
[self save];
|
|
|
|
completion();
|
|
}];
|
|
}
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|