From ff9cf4d40a5752ef7fc0c2c4c2d581cf77bed56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Pantale=C3=A3o?= <5808343+bgoncal@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:56:42 +0100 Subject: [PATCH] Delete old panels from database --- Sources/Shared/Panels/PanelsUpdater.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/Shared/Panels/PanelsUpdater.swift b/Sources/Shared/Panels/PanelsUpdater.swift index 7718ee6b0..ffc108aab 100644 --- a/Sources/Shared/Panels/PanelsUpdater.swift +++ b/Sources/Shared/Panels/PanelsUpdater.swift @@ -1,5 +1,6 @@ import Foundation import PromiseKit +import GRDB public protocol PanelsUpdaterProtocol { func update() @@ -36,6 +37,8 @@ final class PanelsUpdater: PanelsUpdaterProtocol { do { try Current.database.write { db in + try AppPanel.filter(Column(DatabaseTables.AppPanel.serverId.rawValue) == server.identifier.rawValue) + .deleteAll(db) for panel in appPanels { try panel.save(db) }