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
@@ -14,10 +14,9 @@ class UserDao extends DatabaseAccessor<MoorChatDatabase> with _$UserDaoMixin {
/// Updates the users data with the new [userList] data
Future<void> updateUsers(List<User> userList) => batch(
(it) => it.insertAll(
(it) => it.insertAllOnConflictUpdate(
users,
userList.map((u) => u.toEntity()).toList(),
mode: InsertMode.insertOrReplace,
),
);