diff --git a/Frameworks/RSDatabase/RSDatabase/DatabaseLookupTable.swift b/Frameworks/RSDatabase/RSDatabase/DatabaseLookupTable.swift index eefb968f1..0dec93042 100644 --- a/Frameworks/RSDatabase/RSDatabase/DatabaseLookupTable.swift +++ b/Frameworks/RSDatabase/RSDatabase/DatabaseLookupTable.swift @@ -75,6 +75,8 @@ public final class DatabaseLookupTable { } } +// MARK: - Private + private extension DatabaseLookupTable { // MARK: Removing @@ -187,6 +189,10 @@ private extension DatabaseLookupTable { func saveLookups(for objectID: String, _ relatedObjectIDs: Set, _ database: FMDatabase) { + for relatedObjectID in relatedObjectIDs { + let d: [NSObject: Any] = [(objectIDKey as NSString): objectID, (relatedObjectIDKey as NSString): relatedObjectID] + let _ = database.rs_insertRow(with: d, insertType: .orIgnore, tableName: name) + } } // MARK: Attaching @@ -269,6 +275,8 @@ private extension DatabaseLookupTable { } } +// MARK: - + private struct LookupTable { private let dictionary: [String: Set] // objectID: Set