Fix migration

multistore
Laurent 1 year ago
parent f82591c1b5
commit 0cc44f46f2
  1. 2
      LeStorage/Store.swift
  2. 4
      LeStorage/StoredCollection.swift

@ -211,7 +211,7 @@ open class Store {
}
self._validIds.append(contentsOf: filtered.map { $0.stringId })
try? collection.addOrUpdate(contentOfs: filtered)
try? collection.addOrUpdateNoSync(contentOfs: filtered)
Logger.log("Migrated \(filtered.count) \(T.resourceName())")
}

@ -304,6 +304,10 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti
try self._addOrUpdate(contentOfs: sequence)
}
func addOrUpdateNoSync(contentOfs sequence: any Sequence<T>) throws {
try self._addOrUpdate(contentOfs: sequence, shouldSync: false)
}
/// Inserts or updates all items in the sequence
fileprivate func _addOrUpdate(contentOfs sequence: any Sequence<T>, shouldSync: Bool = true) throws {
defer {

Loading…
Cancel
Save