aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe-black-eagle <g.moore@gmx.co.uk>2024-01-02 13:32:59 +0000
committerthe-black-eagle <g.moore@gmx.co.uk>2024-01-02 13:32:59 +0000
commit85badae9573528b19448f25a2040967691b525e4 (patch)
treea993ed3dac3cd4de0525d4b102fb50909b18d1b3
parentae929cf227e4b030c21254b7047534321e4bbc29 (diff)
[MUSIC] Only drop sql triggers on cleaning if they exist
-rw-r--r--xbmc/music/MusicDatabase.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp
index 8468168beb..91ff20846b 100644
--- a/xbmc/music/MusicDatabase.cpp
+++ b/xbmc/music/MusicDatabase.cpp
@@ -4444,8 +4444,11 @@ int CMusicDatabase::Cleanup(CGUIDialogProgress* progressDialog /*= nullptr*/)
SetLibraryLastCleaned();
// Drop triggers song_artist and album_artist to avoid creation of entries in removed_link
- m_pDS->exec("DROP TRIGGER tgrDeleteSongArtist");
- m_pDS->exec("DROP TRIGGER tgrDeleteAlbumArtist");
+ // Check that triggers actually exist first as interrupting the clean causes them to not be
+ // re-created
+
+ m_pDS->exec("DROP TRIGGER IF EXISTS tgrDeleteSongArtist");
+ m_pDS->exec("DROP TRIGGER IF EXISTS tgrDeleteAlbumArtist");
// first cleanup any songs with invalid paths
if (progressDialog)