From 236d94622c44b605aa69f25b1a1e1df6f7a06f19 Mon Sep 17 00:00:00 2001 From: otsmr Date: Sun, 17 May 2026 20:30:15 +0200 Subject: [PATCH] only migrate if not yet opened --- lib/src/services/migrations.service.dart | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/src/services/migrations.service.dart b/lib/src/services/migrations.service.dart index 6e5497bb..9ba47d8e 100644 --- a/lib/src/services/migrations.service.dart +++ b/lib/src/services/migrations.service.dart @@ -158,13 +158,18 @@ Future runMigrations() async { final now = clock.now(); for (final messageId in messageIds.first.split(',')) { await (twonlyDB.update( - twonlyDB.messages, - )..where((tbl) => tbl.messageId.equals(messageId))).write( - MessagesCompanion( - openedAt: Value(now), - openedByAll: Value(now), - ), - ); + twonlyDB.messages, + )..where( + (tbl) => + tbl.messageId.equals(messageId) & + (tbl.openedByAll.isNull() | tbl.openedAt.isNull()), + )) + .write( + MessagesCompanion( + openedAt: Value(now), + openedByAll: Value(now), + ), + ); } } }