mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-03-03 17:06:47 +00:00
fix increased twonly safe backup
This commit is contained in:
parent
7ac10d8326
commit
aee31f5b40
3 changed files with 14 additions and 0 deletions
|
|
@ -65,6 +65,7 @@ void main() async {
|
|||
twonlyDB = TwonlyDB();
|
||||
|
||||
await twonlyDB.messagesDao.purgeMessageTable();
|
||||
await twonlyDB.receiptsDao.purgeReceivedReceipts();
|
||||
unawaited(MediaFileService.purgeTempFolder());
|
||||
|
||||
await initFileDownloader();
|
||||
|
|
|
|||
|
|
@ -51,6 +51,18 @@ class ReceiptsDao extends DatabaseAccessor<TwonlyDB> with _$ReceiptsDaoMixin {
|
|||
.go();
|
||||
}
|
||||
|
||||
Future<void> purgeReceivedReceipts() async {
|
||||
await (delete(receivedReceipts)
|
||||
..where(
|
||||
(t) => (t.createdAt.isSmallerThanValue(
|
||||
clock.now().subtract(
|
||||
const Duration(days: 25),
|
||||
),
|
||||
)),
|
||||
))
|
||||
.go();
|
||||
}
|
||||
|
||||
Future<Receipt?> insertReceipt(ReceiptsCompanion entry) async {
|
||||
try {
|
||||
var insertEntry = entry;
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ class TwonlyDB extends _$TwonlyDB {
|
|||
))
|
||||
.go();
|
||||
await delete(receipts).go();
|
||||
await delete(receivedReceipts).go();
|
||||
await update(contacts).write(
|
||||
const ContactsCompanion(
|
||||
avatarSvgCompressed: Value(null),
|
||||
|
|
|
|||
Loading…
Reference in a new issue