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
@@ -42,10 +42,9 @@ class ChannelDao extends DatabaseAccessor<MoorChatDatabase>
/// Updates all the channels using the new [channelList] data
Future<void> updateChannels(List<ChannelModel> channelList) => batch(
(it) => it.insertAll(
(it) => it.insertAllOnConflictUpdate(
channels,
channelList.map((c) => c.toEntity()).toList(),
mode: InsertMode.insertOrReplace,
),
);
}