From 51c7ffdf3c8b20bed0b6abf2378f779a842cc3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Pantale=C3=A3o=20Gon=C3=A7alves?= <5808343+bgoncal@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:10:14 +0100 Subject: [PATCH] Delete old panels from database (#3277) ## Summary ## Screenshots ## Link to pull request in Documentation repository Documentation: home-assistant/companion.home-assistant# ## Any other notes --- 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..a6b616528 100644 --- a/Sources/Shared/Panels/PanelsUpdater.swift +++ b/Sources/Shared/Panels/PanelsUpdater.swift @@ -1,4 +1,5 @@ import Foundation +import GRDB import PromiseKit public protocol PanelsUpdaterProtocol { @@ -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) }