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.
32 lines
1.2 KiB
Swift
32 lines
1.2 KiB
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import GRDB
|
|
import SessionUtilitiesKit
|
|
|
|
enum _009_OpenGroupPermission: Migration {
|
|
static let target: TargetMigrations.Identifier = .messagingKit
|
|
static let identifier: String = "OpenGroupPermission"
|
|
static let minExpectedRunDuration: TimeInterval = 0.01
|
|
static let fetchedTables: [(TableRecord & FetchableRecord).Type] = []
|
|
static let createdOrAlteredTables: [(TableRecord & FetchableRecord).Type] = [OpenGroup.self]
|
|
static let droppedTables: [(TableRecord & FetchableRecord).Type] = []
|
|
|
|
static func migrate(_ db: Database, using dependencies: Dependencies) throws {
|
|
try db.alter(table: "openGroup") { t in
|
|
t.add(column: "permissions", .integer)
|
|
.defaults(to: OpenGroup.Permissions.all)
|
|
}
|
|
|
|
// When modifying OpenGroup behaviours we should always look to reset the `infoUpdates`
|
|
// value for all OpenGroups to ensure they all have the correct state for newly
|
|
// added/changed fields
|
|
try db.execute(sql: """
|
|
UPDATE openGroup
|
|
SET infoUpdates = 0
|
|
""")
|
|
|
|
Storage.update(progress: 1, for: self, in: target, using: dependencies)
|
|
}
|
|
}
|