mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
529e416dd1
Setup a migration pattern Setup the database configuration and security Started defining the database schema Started working on the migrations for SessionSnodeKit
36 lines
1.1 KiB
Swift
36 lines
1.1 KiB
Swift
import SessionMessagingKit
|
|
import SessionSnodeKit
|
|
|
|
extension OWSPrimaryStorage : OWSPrimaryStorageProtocol { }
|
|
|
|
var isSetup: Bool = false // TODO: Remove this
|
|
|
|
@objc(SNConfiguration)
|
|
public final class Configuration : NSObject {
|
|
|
|
|
|
@objc public static func performMainSetup() {
|
|
// Need to do this first to ensure the legacy database exists
|
|
SNUtilitiesKit.configure(
|
|
owsPrimaryStorage: OWSPrimaryStorage.shared(),
|
|
maxFileSize: UInt(Double(FileServerAPIV2.maxFileSize) / FileServerAPIV2.fileSizeORMultiplier)
|
|
)
|
|
|
|
if !isSetup {
|
|
isSetup = true
|
|
|
|
// TODO: Need to store this result somewhere?
|
|
// TODO: This function seems to get called multiple times
|
|
//DispatchQueue.main.once
|
|
let storage: GRDBStorage? = try? GRDBStorage(
|
|
migrations: [
|
|
SNSnodeKit.migrations(),
|
|
SNMessagingKit.migrations()
|
|
]
|
|
)
|
|
}
|
|
|
|
SNMessagingKit.configure(storage: Storage.shared)
|
|
SNSnodeKit.configure(storage: Storage.shared)
|
|
}
|
|
}
|