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.
		
		
		
		
		
			
		
			
				
	
	
		
			29 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			29 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Swift
		
	
| // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
 | |
| 
 | |
| import Foundation
 | |
| import GRDB
 | |
| import YapDatabase
 | |
| import SessionUtilitiesKit
 | |
| 
 | |
| enum _004_FlagMessageHashAsDeletedOrInvalid: Migration {
 | |
|     static let target: TargetMigrations.Identifier = .snodeKit
 | |
|     static let identifier: String = "FlagMessageHashAsDeletedOrInvalid" // stringlint:disable
 | |
|     static let needsConfigSync: Bool = false
 | |
|     static let fetchedTables: [(TableRecord & FetchableRecord).Type] = []
 | |
|     static let createdOrAlteredTables: [(TableRecord & FetchableRecord).Type] = [SnodeReceivedMessageInfo.self]
 | |
|     
 | |
|     /// This migration adds a flat to the `SnodeReceivedMessageInfo` so that when deleting interactions we can
 | |
|     /// ignore their hashes when subsequently trying to fetch new messages (which results in the storage server returning
 | |
|     /// messages from the beginning of time)
 | |
|     static let minExpectedRunDuration: TimeInterval = 0.2
 | |
|     
 | |
|     static func migrate(_ db: Database) throws {
 | |
|         try db.alter(table: SnodeReceivedMessageInfo.self) { t in
 | |
|             t.add(.wasDeletedOrInvalid, .boolean)
 | |
|                 .indexed()                                 // Faster querying
 | |
|         }
 | |
|         
 | |
|         Storage.update(progress: 1, for: self, in: target) // In case this is the last migration
 | |
|     }
 | |
| }
 |