only migrate if not yet opened
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run

This commit is contained in:
otsmr 2026-05-17 20:30:15 +02:00
parent 5bcb3b3efe
commit 236d94622c

View file

@ -158,13 +158,18 @@ Future<void> 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),
),
);
}
}
}