fix(persistence): change mode insert or replace to upsert

This commit is contained in:
Dmitry Zhifarsky
2021-08-08 21:42:27 +03:00
parent 70fdd42e58
commit 8adc38f8e4
9 changed files with 9 additions and 18 deletions
@@ -30,10 +30,9 @@ class ReadDao extends DatabaseAccessor<MoorChatDatabase> with _$ReadDaoMixin {
/// Updates the read data of a particular channel with
/// the new [readList] data
Future<void> updateReads(String cid, List<Read> readList) => batch(
(it) => it.insertAll(
(it) => it.insertAllOnConflictUpdate(
reads,
readList.map((r) => r.toEntity(cid: cid)).toList(),
mode: InsertMode.insertOrReplace,
),
);
}