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.
|
|
|
//
|
|
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import SignalServiceKit
|
|
|
|
|
|
|
|
@objc
|
|
|
|
public class OWS111UDAttributesMigration: OWSDatabaseMigration {
|
|
|
|
|
|
|
|
// MARK: -
|
|
|
|
|
|
|
|
// increment a similar constant for each migration.
|
|
|
|
@objc
|
|
|
|
class func migrationId() -> String {
|
|
|
|
// NOTE: Changes were made to the service after this migration was initially
|
|
|
|
// merged, so we need to re-migrate any developer devices.
|
|
|
|
return "111.1"
|
|
|
|
}
|
|
|
|
|
|
|
|
override public func runUp(completion: @escaping OWSDatabaseMigrationCompletion) {
|
|
|
|
Logger.debug("")
|
|
|
|
BenchAsync(title: "UD Attributes Migration") { completeBenchmark in
|
|
|
|
self.doMigration {
|
|
|
|
completeBenchmark()
|
|
|
|
completion()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private func doMigration(completion: @escaping OWSDatabaseMigrationCompletion) {
|
|
|
|
return SignalServiceRestClient().updateAcountAttributes().then(execute: { _ in
|
|
|
|
self.dbReadWriteConnection().readWrite { transaction in
|
|
|
|
self.save(with: transaction)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.always {
|
|
|
|
completion()
|
|
|
|
}.retainUntilComplete()
|
|
|
|
}
|
|
|
|
}
|